mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-06 13:00:59 -04:00
Add tests showing that a finished bisect doesn't select the first bad commit
When the user marks the last commit to test as good, git reports the commit that is marked bad as the first bad commit. The commits view keeps the commit that the user just marked selected, though, so the user has to look for the result. The same happens when lazygit starts after a bisect has finished. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
350c061081
commit
e080c08b90
@@ -0,0 +1,42 @@
|
||||
package bisect
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var SelectFirstBadCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Select the first bad commit when marking the last commit to test finishes the bisect",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
CreateNCommits(10).
|
||||
StartBisect("HEAD~2", "HEAD~5")
|
||||
},
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Git.Log.ShowGraph = "never"
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
IsFocused().
|
||||
TopLines(
|
||||
Contains("CI commit-10"),
|
||||
Contains("CI commit-09"),
|
||||
Contains("CI commit-08").Contains("<-- bad"),
|
||||
Contains("CI commit-07").Contains("<-- current").IsSelected(),
|
||||
Contains("CI commit-06"),
|
||||
Contains("CI commit-05").Contains("<-- good"),
|
||||
).
|
||||
Press(keys.Commits.ViewBisectOptions).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as good`)).Confirm()
|
||||
|
||||
t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit-08.*Do you want to reset")).Cancel()
|
||||
}).
|
||||
/* EXPECTED:
|
||||
SelectedLine(Contains("CI commit-08").Contains("<-- bad"))
|
||||
ACTUAL: */
|
||||
SelectedLine(Contains("CI commit-07"))
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,31 @@
|
||||
package bisect
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var SelectFirstBadCommitOnStartup = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Select the first bad commit when starting with a finished bisect",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
CreateNCommits(10).
|
||||
StartBisect("HEAD~2", "HEAD~5").
|
||||
// Mark commit-07, the commit that git checked out to test. This
|
||||
// finishes the bisect, because commit-08 is bad.
|
||||
RunCommand([]string{"git", "bisect", "good"})
|
||||
},
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Git.Log.ShowGraph = "never"
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
IsFocused().
|
||||
/* EXPECTED:
|
||||
SelectedLine(Contains("CI commit-08").Contains("<-- bad"))
|
||||
ACTUAL: */
|
||||
SelectedLine(Contains("CI commit-07"))
|
||||
},
|
||||
})
|
||||
@@ -41,6 +41,8 @@ var tests = []*components.IntegrationTest{
|
||||
bisect.FromOtherBranch,
|
||||
bisect.SelectCurrentCommit,
|
||||
bisect.SelectCurrentCommitInLongRange,
|
||||
bisect.SelectFirstBadCommit,
|
||||
bisect.SelectFirstBadCommitOnStartup,
|
||||
bisect.Skip,
|
||||
bisect.StartFromBranches,
|
||||
bisect.StartFromSubCommitsAndReflog,
|
||||
|
||||
Reference in New Issue
Block a user