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 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-10-31 11:27:58 +01:00
co-authored by Claude Opus 5.5
parent 208bbce33f
commit 4725e80b34
2 changed files with 63 additions and 0 deletions
@@ -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"),
)
},
})
+1
View File
@@ -36,6 +36,7 @@ import (
var tests = []*components.IntegrationTest{
bisect.Basic,
bisect.CheckOutBranchBeforeBisecting,
bisect.ChooseTerms,
bisect.FromOtherBranch,
bisect.SelectCurrentCommit,