mirror of
https://github.com/stablyai/orca.git
synced 2026-10-02 16:02:15 +00:00
* 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>
25 lines
500 B
TypeScript
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
|
|
}
|
|
}
|