Finer-grained checking of umap files for modifications

Ignore untracked umaps, and allow push/pull for unmodified umaps while there are modifications for other maps.
This commit is contained in:
Steve Streeting 2021-05-18 14:55:10 +01:00
parent 03479c2e2f
commit f17a961d79

View File

@ -140,19 +140,16 @@ if (-not $umapsOK) {
Exit 5 Exit 5
} }
# Check no changes, ONLY to .umap files # Check for changes, ONLY to .umap files
$statusOutput = git status --porcelain *.umap $statusOutput = git status -uno --porcelain *.umap
$modifiedMaps = [System.Collections.ArrayList]@()
foreach ($line in $statusOutput) { foreach ($line in $statusOutput) {
if ($line -like "*.umap*") { if ($line -match "^(?: [^\s]|[^\s] |[^\s][^\s])\s+(.+)$") {
Write-Output "Uncommitted changes to .umap file(s) detected" $filename = $matches[1]
if ($dryrun) { $modifiedMaps.Add($filename) > $null
Write-Output "dryrun: Continuing but this will fail without -dryrun"
break Write-Warning "Uncommitted change: $filename (will be skipped)"
} else {
Write-Output "Cannot continue"
Exit $LASTEXITCODE
}
} }
} }
@ -199,6 +196,11 @@ try {
Write-Verbose "Checking $filename ($oid)" Write-Verbose "Checking $filename ($oid)"
if ($modifiedMaps.Contains($filename)) {
Write-Verbose "Skipping $filename, uncommitted changes"
continue
}
$localbuiltdata, $remotebuiltdata = Get-Builtdata-Paths $umap $syncdir $localbuiltdata, $remotebuiltdata = Get-Builtdata-Paths $umap $syncdir
$same = Compare-Files-Quick $localbuiltdata $remotebuiltdata $same = Compare-Files-Quick $localbuiltdata $remotebuiltdata