mirror of
https://github.com/stablyai/orca.git
synced 2026-09-26 08:02:38 +00:00
* fix(git): share one error-text reader between the local and relay branch-delete fallbacks The relay and the desktop each carried their own `getErrorText`, and they had drifted: the relay read `message` + `stderr` + `stdout`, the desktop only `message` + `stderr`. A `git branch -d` refusal arriving on `stdout` therefore routed the SSH removal through prune-and-retry while the local removal gave up and preserved the branch. Against a real binary the two agree, because Git prints the refusal through `error()` on every supported version — verified on 2.25.1, 2.38.1, 2.49.1 and 2.55.0, none of which put a byte of it on stdout. What the desktop copy actually missed is that Orca classifies errors it built itself, with the Git output on `.stdout`: `worktree remove`'s submodule retry attaches `git status --porcelain` that way on both paths. The stdout-reading form is also already the shared spelling — `isSubmoduleWorktreeRemovalRefusal` uses it for both hosts — so this converges on it rather than on the shorter one. Move the reader to src/shared/git-command-failure-text.ts and the predicate it feeds to src/shared/git-branch-delete-refusal.ts, and delete all three copies. The predicate carries both refusal wordings live in the supported range: Git through 2.40 says "checked out at", 2.43+ says "used by worktree at". The real-binary contract now pins that boundary: the refusal is recognized, it lands on stderr, and stdout stays empty on every Git in the matrix. * fix(test): consolidate the duplicate worktree import in the parity test
13 lines
657 B
TypeScript
13 lines
657 B
TypeScript
import { readGitCommandFailureText } from '../git-command-failure-text'
|
|
|
|
// Why: `git worktree remove` (non-force) categorically refuses any worktree
|
|
// containing an initialised submodule, even when parent and submodule are
|
|
// fully clean (validate_no_submodules, Git >= 2.17). Callers re-prove
|
|
// cleanliness and retry with --force. Both the local runner and the relay pin
|
|
// English git output (UNTRANSLATED_GIT_OUTPUT_ENV), so text matching is stable.
|
|
export function isSubmoduleWorktreeRemovalRefusal(error: unknown): boolean {
|
|
return /working trees containing submodules cannot be moved or removed/i.test(
|
|
readGitCommandFailureText(error)
|
|
)
|
|
}
|