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 <noreply@anthropic.com>
This commit is contained in:
parent
e694ab06d7
commit
cc61e09384
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -135,7 +135,10 @@ export async function commit(message: string, cwd: string): Promise<void> {
|
|||
|
||||
/** Stage a file. */
|
||||
export async function stageFile(file: string, cwd: string): Promise<void> {
|
||||
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. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user