Skip to main content

resolve_default_branch

Function resolve_default_branch 

Source
async fn resolve_default_branch(cwd: &Path, budget: Duration) -> Option<String>
Expand description

Resolve the ref a feature branch’s “ahead” diff compares against. Prefers the remote-tracking origin/<default> (via origin/HEAD, else origin/main / origin/master) so a locally-stale main can’t fold already-merged commits into the diff; falls back to a purely-local main / master for a repo with no origin remote. The returned value IS the compare-ref - the origin/ prefix carries the remote-vs-local decision, so callers wanting the plain branch name strip it. None when nothing resolves.