Browse Source

fix: detect remote divergence before sync

main
Daniel Kucinski 1 month ago
parent
commit
574fc47197
  1. 9
      sync-skills.ps1

9
sync-skills.ps1

@ -78,6 +78,15 @@ try {
}
Write-SyncLog -Level INFO -Message "Starting sync from '$sourceRoot'."
Invoke-Git -Arguments @('fetch', 'origin', 'main')
$remoteAhead = [int](& git -C $repositoryRoot rev-list --count 'main..origin/main')
if ($LASTEXITCODE -ne 0) {
throw 'Unable to determine whether the remote branch is ahead.'
}
if ($remoteAhead -gt 0) {
throw "Remote branch origin/main is ahead by $remoteAhead commit(s); merge it before syncing."
}
New-Item -ItemType Directory -Path $stagingRoot | Out-Null
$sourceSkills = Get-ChildItem -LiteralPath $sourceRoot -Directory | Sort-Object Name

Loading…
Cancel
Save