From 4725e80b343c58efec7f1104df53d9f1452ac344 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 30 Oct 2026 20:42:55 +0100 Subject: [PATCH] Add a test showing that a checkout before bisecting doesn't update the log Once a bisect has started, the commits view shows the log of the branch that was checked out when it started. This happens even while we don't know both a good and a bad commit yet, and git hasn't checked out anything for the user to test. If the user checks out a different branch to mark its head as bad, the commits view keeps showing the old branch, so the new branch's head isn't there to be marked. Co-Authored-By: Claude Opus 5.5 --- .../check_out_branch_before_bisecting.go | 62 +++++++++++++++++++ pkg/integration/tests/test_list.go | 1 + 2 files changed, 63 insertions(+) create mode 100644 pkg/integration/tests/bisect/check_out_branch_before_bisecting.go diff --git a/pkg/integration/tests/bisect/check_out_branch_before_bisecting.go b/pkg/integration/tests/bisect/check_out_branch_before_bisecting.go new file mode 100644 index 000000000..b9e7d2bbf --- /dev/null +++ b/pkg/integration/tests/bisect/check_out_branch_before_bisecting.go @@ -0,0 +1,62 @@ +package bisect + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var CheckOutBranchBeforeBisecting = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Check out a different branch after marking a commit as good, but before marking one as bad", + ExtraCmdArgs: []string{}, + Skip: false, + SetupRepo: func(shell *Shell) { + shell. + CreateNCommits(3). + NewBranch("feature"). + CreateNCommitsStartingAt(3, 4). + Checkout("master") + }, + SetupConfig: func(cfg *config.AppConfig) { + cfg.GetUserConfig().Git.Log.ShowGraph = "never" + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + SelectedLine(Contains("CI commit-03")). + Press(keys.Commits.ViewBisectOptions). + Tap(func() { + t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as good`)).Confirm() + }). + Lines( + Contains("CI commit-03").Contains("<-- good"), + Contains("CI commit-02"), + Contains("CI commit-01"), + ) + + t.Views().Branches(). + Focus(). + NavigateToLine(Contains("feature")). + PressPrimaryAction(). + Lines( + Contains("* feature"), + Contains("master"), + ) + + t.Views().Commits(). + /* EXPECTED: + Lines( + Contains("CI commit-06"), + Contains("CI commit-05"), + Contains("CI commit-04"), + Contains("CI commit-03").Contains("<-- good"), + Contains("CI commit-02"), + Contains("CI commit-01"), + ) + ACTUAL: */ + Lines( + Contains("CI commit-03").Contains("<-- good"), + Contains("CI commit-02"), + Contains("CI commit-01"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 3fab3959d..15aa27ea5 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -36,6 +36,7 @@ import ( var tests = []*components.IntegrationTest{ bisect.Basic, + bisect.CheckOutBranchBeforeBisecting, bisect.ChooseTerms, bisect.FromOtherBranch, bisect.SelectCurrentCommit,