die more gracefully
This commit is contained in:
parent
3888876ed5
commit
be29b5fcd7
|
|
@ -131,6 +131,6 @@ export async function hasNewCommits(worktreePath: string): Promise<boolean> {
|
||||||
/** Detect the main branch name (main or master). */
|
/** Detect the main branch name (main or master). */
|
||||||
export async function mainBranch(cwd?: string): Promise<string> {
|
export async function mainBranch(cwd?: string): Promise<string> {
|
||||||
const dir = cwd ?? "."
|
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"
|
return result.exitCode === 0 ? "main" : "master"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user