From cc61e09384412eef02abc8ce7a85ccf1080fb64d Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Fri, 10 Apr 2026 08:07:43 -0700 Subject: [PATCH] Propagate git-add failures instead of silently swallowing them The old `stageFile` call discarded non-zero exit codes, hiding issues like unresolved conflicts or missing files from the caller. Co-Authored-By: Claude Opus 4.6 --- src/commands/helpers.ts | 2 +- src/git.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands/helpers.ts b/src/commands/helpers.ts index 308dd99..fdaba79 100644 --- a/src/commands/helpers.ts +++ b/src/commands/helpers.ts @@ -81,7 +81,7 @@ export async function teardownSession(root: string, branch: string, worktree: st await state.removeSession(root, branch) } -/** Lock files to skip AI resolution — accept theirs and move on (basename match covers subdirs too). */ +/** Lock files to skip AI resolution — accept theirs and move on (basename match so `packages/foo/bun.lock` is also covered). */ const SKIP_RESOLVE = new Set(["bun.lock", "Cargo.lock"]) /** Resolve conflict markers in files using Claude, then stage them. */ diff --git a/src/git.ts b/src/git.ts index 6afb717..810146b 100644 --- a/src/git.ts +++ b/src/git.ts @@ -135,7 +135,10 @@ export async function commit(message: string, cwd: string): Promise { /** Stage a file. */ export async function stageFile(file: string, cwd: string): Promise { - await $`git add ${file}`.cwd(cwd).nothrow().quiet() + const result = await $`git add ${file}`.cwd(cwd).nothrow().quiet() + if (result.exitCode !== 0) { + throw new Error(`Failed to stage ${file}: ${result.stderr.toString().trim()}`) + } } /** Finalize a merge commit after resolving conflicts. */