Sync SharedCode snapshot from dfae1cb
This commit is contained in:
1 parent
efc7aae0aa
commit
aa19576a50
2 files changed
+57
-45
No files matched your search
@@ -40,8 +40,15 @@ function Invoke-GitText {
|
||||
$output = & git -C $WorkingDirectory @Arguments 2>&1
|
||||
$exitCode = $LASTEXITCODE
|
||||
if ($exitCode -ne 0) {
|
||||
$details = ($output | ForEach-Object { [string]$_ }) -join [Environment]::NewLine
|
||||
throw "git $($Arguments -join ' ') failed in '$WorkingDirectory'. $details"
|
||||
$diagnostics = @($output | ForEach-Object { [string]$_ } | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
|
||||
$blockingDiagnostics = @($diagnostics | Where-Object { $_ -notmatch '^\s*(warning|hint):' })
|
||||
if ($blockingDiagnostics.Count -eq 0) {
|
||||
$diagnostics | ForEach-Object { Write-Warning $_ }
|
||||
}
|
||||
else {
|
||||
$details = $diagnostics -join [Environment]::NewLine
|
||||
throw "git $($Arguments -join ' ') failed in '$WorkingDirectory'. $details"
|
||||
}
|
||||
}
|
||||
|
||||
return @($output | ForEach-Object { [string]$_ })
|
||||
@@ -84,7 +91,8 @@ function Write-Utf8NoBom {
|
||||
)
|
||||
|
||||
$encoding = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::WriteAllText($Path, $Content, $encoding)
|
||||
$normalizedContent = $Content.Replace("`r`n", "`n").Replace("`r", "`n")
|
||||
[System.IO.File]::WriteAllText($Path, $normalizedContent, $encoding)
|
||||
}
|
||||
|
||||
function Convert-ToConsumerWebUiPackage {
|
||||
@@ -284,6 +292,10 @@ foreach ($relativeProject in $consumerProjects) {
|
||||
$commitArguments = @('commit', '--only', '-m', $commitMessage, '--') + $targetPaths
|
||||
$commitOutput = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments $commitArguments)
|
||||
$commitOutput | ForEach-Object { Write-Host " $_" }
|
||||
$remainingStagedChanges = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments (@('diff', '--cached', '--name-only', '--') + $targetPaths))
|
||||
if ($remainingStagedChanges.Count -gt 0) {
|
||||
throw 'The generated synchronization changes remain staged after the commit.'
|
||||
}
|
||||
}
|
||||
|
||||
if ($Push) {
|
||||
|
||||
Reference in new issue
Block a user