An existing develop outranks a main-pointing origin/HEAD

Cursor Bugbot's remaining round-1 finding held for the current code
too: in a git-flow repo whose platform default was never flipped off
main, a feature branch without an upstream picked origin/HEAD's main
over the develop branch features actually merge to, dragging the
develop-vs-main divergence into scan targets. develop now sits between
the upstream signal and origin/HEAD in the candidate order; repos
without a develop branch are unaffected. Failing-first test covers the
exact shape (develop exists, origin/HEAD -> main).

Prepared with AI assistance (Claude Code), directed by @pbakaus.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-07-25 20:17:55 -07:00
co-authored by Claude Code
parent b9d294b29c
commit e82653965c
2 changed files with 31 additions and 1 deletions
+6 -1
View File
@@ -129,8 +129,13 @@ function gitSignals(cwd) {
// The upstream tracks the actual merge target, so its own rev wins over
// a possibly stale local branch of the same name.
if (upstream) addCandidate(upstream.name, [upstream.rev]);
// A develop branch marks a git-flow repo where features merge to develop
// even when the platform default (origin/HEAD) was never flipped off
// main; an existing develop therefore outranks the remote default. This
// is #302's own repro shape, and repos without develop are unaffected.
addCandidate('develop', ['develop', 'origin/develop']);
if (remoteHead) addCandidate(remoteHead.name, [remoteHead.name, remoteHead.rev]);
for (const name of conventional) addCandidate(name, [name, `origin/${name}`]);
for (const name of ['main', 'master']) addCandidate(name, [name, `origin/${name}`]);
for (const c of candidates) {
const rev = c.revs.find((r) => run(['rev-parse', '--verify', '--quiet', r]) !== null);
if (rev) {