From fd7178a3a96603bbf9e6843c127629eb3c4c89d7 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 31 Oct 2026 12:15:16 +0100 Subject: [PATCH] Add tests showing that some commits to bisect lack the "?" mark The commits view marks the commits between the bad commit and the first good commit in the list with a "?". If there's no good commit in the list, it doesn't mark any. This is the case while git tests the merge base of a good and a bad commit on different branches. It's also the case early in a long bisect, when the good commit is further down than the commits that we load. Co-Authored-By: Claude Opus 5.5 --- ...ark_candidates_while_testing_merge_base.go | 41 +++++++++++++++++++ .../select_current_commit_in_long_range.go | 12 +++++- pkg/integration/tests/test_list.go | 1 + 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 pkg/integration/tests/bisect/mark_candidates_while_testing_merge_base.go diff --git a/pkg/integration/tests/bisect/mark_candidates_while_testing_merge_base.go b/pkg/integration/tests/bisect/mark_candidates_while_testing_merge_base.go new file mode 100644 index 000000000..7e8994dc6 --- /dev/null +++ b/pkg/integration/tests/bisect/mark_candidates_while_testing_merge_base.go @@ -0,0 +1,41 @@ +package bisect + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var MarkCandidatesWhileTestingMergeBase = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Mark the commits that the bisect hasn't ruled out yet while git tests the merge base of the good and the bad commit", + ExtraCmdArgs: []string{}, + Skip: false, + SetupRepo: func(shell *Shell) { + shell. + CreateNCommits(2). + NewBranch("fixed"). + CreateNCommitsStartingAt(1, 3). + Checkout("master"). + CreateNCommitsStartingAt(2, 4). + // The good commit-03 is on another branch, so git checks out the + // merge base commit-02 to test first + StartBisect("master", "fixed") + }, + SetupConfig: func(cfg *config.AppConfig) { + cfg.GetUserConfig().Git.Log.ShowGraph = "never" + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + IsFocused(). + Lines( + Contains("CI commit-05").Contains("<-- bad"), + /* EXPECTED: + MatchesRegexp(`\?.*commit-04`), + ACTUAL: */ + Contains("CI commit-04").DoesNotContain("?"), + Contains("CI commit-02").Contains("<-- current").IsSelected(), + // This is an ancestor of the good commit-03, so the bisect has + // ruled it out + Contains("CI commit-01").DoesNotContain("?"), + ) + }, +}) diff --git a/pkg/integration/tests/bisect/select_current_commit_in_long_range.go b/pkg/integration/tests/bisect/select_current_commit_in_long_range.go index 09794c59f..5f0caa183 100644 --- a/pkg/integration/tests/bisect/select_current_commit_in_long_range.go +++ b/pkg/integration/tests/bisect/select_current_commit_in_long_range.go @@ -8,7 +8,7 @@ import ( ) var SelectCurrentCommitInLongRange = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Select the current bisect commit when it is further down than the commits that we load at first", + Description: "Select the current bisect commit when it is further down than the commits that we load at first, and mark the commits around it that the bisect hasn't ruled out yet", ExtraCmdArgs: []string{}, Skip: false, SetupRepo: func(shell *Shell) { @@ -23,6 +23,14 @@ var SelectCurrentCommitInLongRange = NewIntegrationTest(NewIntegrationTestArgs{ Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). - SelectedLine(Contains("<-- current")) + SelectedLine(Contains("<-- current")). + // The commits between the current one and the good one are still + // to be tested. The good one is further down than the commits that + // we load. + SelectNextItem(). + /* EXPECTED: + SelectedLine(Contains("?")) + ACTUAL: */ + SelectedLine(DoesNotContain("?")) }, }) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 4122c1188..acbe5b445 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -39,6 +39,7 @@ var tests = []*components.IntegrationTest{ bisect.CheckOutBranchBeforeBisecting, bisect.ChooseTerms, bisect.FromOtherBranch, + bisect.MarkCandidatesWhileTestingMergeBase, bisect.OfferResetWhenMergeBaseIsBad, bisect.SelectCurrentCommit, bisect.SelectCurrentCommitInLongRange,