From 44d3d75546fc02224f715889fb49acef04e3f798 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Sat, 1 Aug 2026 20:33:56 +0700 Subject: [PATCH] fix: run tea outside git work tree so --login is honored Invoke-Tea started its job in the caller's directory. When that is a git work tree, tea infers the target from the local remote, and a remote that matches no configured login makes it discard --login, fall back to the first login, and fail with "remote repository required". Pin the job to a neutral directory so the requested login always resolves. --- .../scripts/cleanup-failed-mirrors.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gitea-mirror-local/.claude/skills/gitea-mirror-maintenance/scripts/cleanup-failed-mirrors.ps1 b/gitea-mirror-local/.claude/skills/gitea-mirror-maintenance/scripts/cleanup-failed-mirrors.ps1 index 00e331e..de0c274 100644 --- a/gitea-mirror-local/.claude/skills/gitea-mirror-maintenance/scripts/cleanup-failed-mirrors.ps1 +++ b/gitea-mirror-local/.claude/skills/gitea-mirror-maintenance/scripts/cleanup-failed-mirrors.ps1 @@ -54,8 +54,13 @@ if ($planAge.TotalMinutes -gt 15) { if ($targets.Count -eq 0) { "No repos match case(s): $($Case -join ',')"; return } # tea reads stdin on some paths; run it as a job so it can never hang the script. +# The job must not start inside a git work tree: tea infers its target from the +# local remote, and when that remote matches no configured login it discards +# --login and fails with "remote repository required". Run from a neutral dir. function Invoke-Tea([string[]]$TeaArgs, [int]$Timeout) { - $j = Start-Job -ArgumentList $TeaArgs { param($a) & tea @a 2>&1; "EXIT:$LASTEXITCODE" } + $j = Start-Job -ArgumentList $TeaArgs, $env:TEMP { + param($a, $neutral) Set-Location $neutral; & tea @a 2>&1; "EXIT:$LASTEXITCODE" + } if (Wait-Job $j -Timeout $Timeout) { $out = Receive-Job $j; Remove-Job $j -Force $code = ($out | Where-Object { $_ -like 'EXIT:*' }) -replace 'EXIT:', ''