refactor: simplify pass (trekexecute)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
76f74793e9
commit
52c382c198
8 changed files with 45 additions and 52 deletions
|
|
@ -98,8 +98,10 @@ function headIsUnborn(root) {
|
|||
if (sym.error || sym.status !== 0) return false;
|
||||
const ref = String(sym.stdout ?? '').trim();
|
||||
if (!/^refs\/heads\/./.test(ref)) return false;
|
||||
if (lexists(resolve(root, git(root, ['rev-parse', '--git-path', ref]).trim()))) return false;
|
||||
const packed = resolve(root, git(root, ['rev-parse', '--git-path', 'packed-refs']).trim());
|
||||
// One call, one output line per --git-path, in argument order.
|
||||
const [loosePath = '', packedPath = ''] = git(root, ['rev-parse', '--git-path', ref, '--git-path', 'packed-refs']).split('\n');
|
||||
if (lexists(resolve(root, loosePath.trim()))) return false;
|
||||
const packed = resolve(root, packedPath.trim());
|
||||
if (lexists(packed)) {
|
||||
const lines = readFileSync(packed, 'utf8').split('\n');
|
||||
if (lines.some((l) => l.endsWith(` ${ref}`))) return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue