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 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-10-31 12:15:16 +01:00
co-authored by Claude Opus 5.5
parent 368633f69c
commit fd7178a3a9
3 changed files with 52 additions and 2 deletions
@@ -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("?"),
)
},
})
@@ -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("?"))
},
})
+1
View File
@@ -39,6 +39,7 @@ var tests = []*components.IntegrationTest{
bisect.CheckOutBranchBeforeBisecting,
bisect.ChooseTerms,
bisect.FromOtherBranch,
bisect.MarkCandidatesWhileTestingMergeBase,
bisect.OfferResetWhenMergeBaseIsBad,
bisect.SelectCurrentCommit,
bisect.SelectCurrentCommitInLongRange,