mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 08:03:28 +00:00
Distinguish expected absence from git errors in remote removal
Why: swallowing all errors silently masks genuine git failures. Check presence explicitly instead, so setup/teardown can still skip when origin is absent while letting real errors surface.
This commit is contained in:
@@ -26,11 +26,18 @@ async function writeEvidence(
|
||||
}
|
||||
|
||||
function removeOriginRemoteIfPresent(cwd: string): void {
|
||||
try {
|
||||
execFileSync('git', ['remote', 'remove', 'origin'], { cwd, stdio: 'pipe' })
|
||||
} catch {
|
||||
// Why: setup and teardown must not fail just because origin is absent.
|
||||
// Why: check presence instead of swallowing errors, so real Git failures still surface.
|
||||
const remotes = execFileSync('git', ['remote'], {
|
||||
cwd,
|
||||
encoding: 'utf8',
|
||||
stdio: ['ignore', 'pipe', 'pipe']
|
||||
})
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
if (!remotes.includes('origin')) {
|
||||
return
|
||||
}
|
||||
execFileSync('git', ['remote', 'remove', 'origin'], { cwd, stdio: 'pipe' })
|
||||
}
|
||||
|
||||
test.describe('Source Control Create PR intent worktree switching', () => {
|
||||
|
||||
Reference in New Issue
Block a user