Fix ahead-of-origin count for branches with no remote tracking branch
Fall back to counting all local commits when the origin comparison fails, instead of returning null.
This commit is contained in:
@@ -1005,7 +1005,16 @@ async function getAheadOfOrigin(cwd: string, currentBranch: string): Promise<num
|
|||||||
const count = Number.parseInt(stdout.trim(), 10);
|
const count = Number.parseInt(stdout.trim(), 10);
|
||||||
return Number.isNaN(count) ? null : count;
|
return Number.isNaN(count) ? null : count;
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
try {
|
||||||
|
const { stdout } = await execAsync(
|
||||||
|
`git rev-list --count ${currentBranch}`,
|
||||||
|
{ cwd, env: READ_ONLY_GIT_ENV },
|
||||||
|
);
|
||||||
|
const count = Number.parseInt(stdout.trim(), 10);
|
||||||
|
return Number.isNaN(count) ? null : count;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user