sync: BOWEI_US 2026-09-02
This commit is contained in:
@@ -52,10 +52,17 @@ function Invoke-Doctor([string]$Why) {
|
||||
if (-not (Test-Path $doctor)) { Write-Host "gitea_doctor.ps1 not found; cannot repair the server."; return $false }
|
||||
Write-Host ""
|
||||
Write-Host "=== gitea transport check/repair ($Why) ==="
|
||||
$dargs = @("-RepoUrl", $RepoUrl, "-Fix")
|
||||
if ($AllowDestructive) { $dargs += "-AllowDestructive" }
|
||||
& $doctor @dargs
|
||||
$ok = ($LASTEXITCODE -eq 0)
|
||||
# Hashtable splat, not an array: splatting an array passes every element
|
||||
# positionally, so "-Fix" would be bound as a value (it lands on -SshTimeout).
|
||||
$dargs = @{ RepoUrl = $RepoUrl; Fix = $true }
|
||||
if ($AllowDestructive) { $dargs["AllowDestructive"] = $true }
|
||||
$ok = $false
|
||||
try {
|
||||
& $doctor @dargs
|
||||
$ok = ($LASTEXITCODE -eq 0)
|
||||
} catch {
|
||||
Write-Host "doctor could not be invoked: $($_.Exception.Message)"
|
||||
}
|
||||
Write-Host "=== doctor $(if ($ok) { 'reports the transport healthy' } else { 'could NOT restore the transport' }) ==="
|
||||
Write-Host ""
|
||||
return $ok
|
||||
|
||||
Reference in New Issue
Block a user