Files
orca/src/main/git/worktree-base-ref-probe.ts
T
Rod BoevandJinjing 7e1f9e55f2 fix(worktrees): fall back from stale default base refs (#7398)
* fix(worktrees): fall back from stale default base refs (#7312)

* docs(worktrees): explain base fallback policy

* fix(worktrees): harden stale base fallback edge cases

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
2026-07-04 21:31:51 -07:00

25 lines
500 B
TypeScript

import { gitExecFileAsync } from './runner'
type GitExecOptions = {
wslDistro?: string
}
export async function hasWorktreeBaseCommitRef(
repoPath: string,
qualifiedRef: string,
options: GitExecOptions = {}
): Promise<boolean> {
try {
const { stdout } = await gitExecFileAsync(
['rev-parse', '--verify', '--quiet', `${qualifiedRef}^{commit}`],
{
cwd: repoPath,
...options
}
)
return stdout.trim().length > 0
} catch {
return false
}
}