Sync SharedCode snapshot from dfae1cb
This commit is contained in:
1 parent
efc7aae0aa
commit
aa19576a50
1 file changed
+14
-2
@@ -40,9 +40,16 @@ function Invoke-GitText {
|
|||||||
$output = & git -C $WorkingDirectory @Arguments 2>&1
|
$output = & git -C $WorkingDirectory @Arguments 2>&1
|
||||||
$exitCode = $LASTEXITCODE
|
$exitCode = $LASTEXITCODE
|
||||||
if ($exitCode -ne 0) {
|
if ($exitCode -ne 0) {
|
||||||
$details = ($output | ForEach-Object { [string]$_ }) -join [Environment]::NewLine
|
$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"
|
throw "git $($Arguments -join ' ') failed in '$WorkingDirectory'. $details"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return @($output | ForEach-Object { [string]$_ })
|
return @($output | ForEach-Object { [string]$_ })
|
||||||
}
|
}
|
||||||
@@ -84,7 +91,8 @@ function Write-Utf8NoBom {
|
|||||||
)
|
)
|
||||||
|
|
||||||
$encoding = New-Object System.Text.UTF8Encoding($false)
|
$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 {
|
function Convert-ToConsumerWebUiPackage {
|
||||||
@@ -284,6 +292,10 @@ foreach ($relativeProject in $consumerProjects) {
|
|||||||
$commitArguments = @('commit', '--only', '-m', $commitMessage, '--') + $targetPaths
|
$commitArguments = @('commit', '--only', '-m', $commitMessage, '--') + $targetPaths
|
||||||
$commitOutput = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments $commitArguments)
|
$commitOutput = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments $commitArguments)
|
||||||
$commitOutput | ForEach-Object { Write-Host " $_" }
|
$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) {
|
if ($Push) {
|
||||||
|
|||||||
Reference in new issue
Block a user