From efc7aae0aa12466c9a099100fd97d50e1f5fb98b Mon Sep 17 00:00:00 2001 From: Gabriel20xx Date: Thu, 6 Aug 2026 16:05:34 +0200 Subject: [PATCH] Sync SharedCode snapshot from dfae1cb --- SharedCode/scripts/sync-consumers.ps1 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SharedCode/scripts/sync-consumers.ps1 b/SharedCode/scripts/sync-consumers.ps1 index f74dc91..d09ed4c 100644 --- a/SharedCode/scripts/sync-consumers.ps1 +++ b/SharedCode/scripts/sync-consumers.ps1 @@ -37,8 +37,9 @@ function Invoke-GitText { [string[]]$Arguments ) - $output = @(& git -C $WorkingDirectory @Arguments 2>&1) - if ($LASTEXITCODE -ne 0) { + $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" } @@ -248,6 +249,9 @@ foreach ($relativeProject in $consumerProjects) { 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)" Push-Location -LiteralPath $packageFile.DirectoryName try { @@ -260,10 +264,12 @@ foreach ($relativeProject in $consumerProjects) { Pop-Location } - $relativeLockPath = Get-RelativePath -BasePath $projectRoot -TargetPath $lockPath - if ($lockFiles -notcontains $relativeLockPath) { + if ($shouldStageLock -and $lockFiles -notcontains $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')