die more gracefully

This commit is contained in:
Chris Wanstrath 2026-02-20 07:40:24 -08:00
parent 3888876ed5
commit be29b5fcd7

View File

@ -131,6 +131,6 @@ export async function hasNewCommits(worktreePath: string): Promise<boolean> {
/** Detect the main branch name (main or master). */
export async function mainBranch(cwd?: string): Promise<string> {
const dir = cwd ?? "."
const result = await $`git rev-parse --verify --quiet refs/heads/main`.cwd(dir).nothrow().quiet()
const result = await $`git -C ${dir} rev-parse --verify --quiet refs/heads/main`.nothrow().quiet()
return result.exitCode === 0 ? "main" : "master"
}