jesseduffield.lazygit/pkg
Stefan Haller dd03884087 Pick base branch by smallest ahead instead of relying on for-each-ref's order
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.
2026-07-03 19:35:33 +02:00
..
app Allow overriding the platform used for default keybindings 2026-07-03 19:08:22 +02:00
cheatsheet Render every key for a binding in the cheatsheet 2026-05-25 15:18:18 +02:00
commands Pick base branch by smallest ahead instead of relying on for-each-ref's order 2026-07-03 19:35:33 +02:00
common Move NewDummyCommon to pkg/common 2025-05-06 09:43:26 +02:00
config Add gui.shrinkSidePanelsToContent option 2026-07-03 19:25:01 +02:00
constants Make the links in the status panel point to the current version rather than master 2024-03-22 08:13:59 +01:00
env Support bare worktrees where worktree does not have its own .git file 2023-08-07 22:40:53 +10:00
fakes Modernize all codes 2025-11-15 10:46:23 +01:00
gocui Materialize cursor-forward escapes as space runs 2026-07-03 18:47:15 +02:00
gui Add gui.shrinkSidePanelsToContent option 2026-07-03 19:25:01 +02:00
i18n Offer to delete the branch when removing a worktree 2026-07-03 19:04:44 +02:00
integration Offer to delete the branch when removing a worktree 2026-07-03 19:04:44 +02:00
jsonschema Fold legacy quit-alt1 into the multi-key quit binding 2026-05-25 15:32:47 +02:00
logs Fix Windows linter errors 2026-06-16 16:21:13 +02:00
snake Enable intrange linter, and fix warnings 2025-06-30 18:30:11 +02:00
tasks Abstract task command over *exec.Cmd 2026-07-03 18:47:15 +02:00
theme Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
updates Change direct access to Common.UserConfig to a getter 2024-08-18 10:24:52 +02:00
utils Expand a leading ~ in worktree paths to the home directory 2026-07-03 18:53:05 +02:00