Sync SharedCode snapshot from dfae1cb

This commit is contained in:
Gabriel20xx committed 2026-08-06 16:05:34 +02:00
1 parent 96f3082f39
commit efc7aae0aa
1 file changed
+10 -4
+10 -4
View File
@@ -37,8 +37,9 @@ function Invoke-GitText {
[string[]]$Arguments [string[]]$Arguments
) )
$output = @(& git -C $WorkingDirectory @Arguments 2>&1) $output = & git -C $WorkingDirectory @Arguments 2>&1
if ($LASTEXITCODE -ne 0) { $exitCode = $LASTEXITCODE
if ($exitCode -ne 0) {
$details = ($output | ForEach-Object { [string]$_ }) -join [Environment]::NewLine $details = ($output | ForEach-Object { [string]$_ }) -join [Environment]::NewLine
throw "git $($Arguments -join ' ') failed in '$WorkingDirectory'. $details" throw "git $($Arguments -join ' ') failed in '$WorkingDirectory'. $details"
} }
@@ -248,6 +249,9 @@ foreach ($relativeProject in $consumerProjects) {
continue continue
} }
$relativeLockPath = Get-RelativePath -BasePath $projectRoot -TargetPath $lockPath
$trackedLock = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('ls-files', '--', $relativeLockPath))
$shouldStageLock = $trackedLock.Count -gt 0
Write-Host " Updating $relativeProject/$(Get-RelativePath -BasePath $projectRoot -TargetPath $lockPath)" Write-Host " Updating $relativeProject/$(Get-RelativePath -BasePath $projectRoot -TargetPath $lockPath)"
Push-Location -LiteralPath $packageFile.DirectoryName Push-Location -LiteralPath $packageFile.DirectoryName
try { try {
@@ -260,10 +264,12 @@ foreach ($relativeProject in $consumerProjects) {
Pop-Location Pop-Location
} }
$relativeLockPath = Get-RelativePath -BasePath $projectRoot -TargetPath $lockPath if ($shouldStageLock -and $lockFiles -notcontains $relativeLockPath) {
if ($lockFiles -notcontains $relativeLockPath) {
$lockFiles += $relativeLockPath $lockFiles += $relativeLockPath
} }
elseif (-not $shouldStageLock) {
Write-Host " Leaving untracked/ignored lockfile out of the generated commit: $relativeLockPath"
}
} }
$null = Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('add', '--', 'SharedCode') $null = Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('add', '--', 'SharedCode')