mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 08:06:25 -04:00
GetBaseBranch was treating "contains the merge-base" as the equivalence class for "is the closest base," which is too loose — multiple main branches can contain the merge-base when one is dramatically closer to the feature branch than another. The candidate it returned was then whichever ref git for-each-ref happened to list first. For example, a branch forked off "develop" can have its combined merge-base with [main, develop] land on a commit reachable from both (via develop's own branch-off from main). Both main and develop end up in the candidate set, even though by any reasonable measure of closeness the branch differs from develop by a small ahead count and from main by a much larger one. Discriminate within the candidate set using ahead values: for each configured main branch that contains the merge-base, compute the ahead count from branch to base, and pick the candidate with the smallest ahead — the closest base. When more than one candidate is tied at the minimum, return that tied set unchanged so callers can flag the case as genuinely ambiguous instead of silently collapsing it; subsequent commits build the disambiguation prompt on top. |
||
|---|---|---|
| .. | ||
| app | ||
| cheatsheet | ||
| commands | ||
| common | ||
| config | ||
| constants | ||
| env | ||
| fakes | ||
| gocui | ||
| gui | ||
| i18n | ||
| integration | ||
| jsonschema | ||
| logs | ||
| snake | ||
| tasks | ||
| theme | ||
| updates | ||
| utils | ||