mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-21 04:46:29 +03:00
After marking the first commit as good or bad, the bisect menu's entries act on the selected commit until git knows both a good and a bad commit. They called it the "current commit" though, as if it was the commit that git wants the user to test. Call it "commit <hash>" instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
101 lines
3.6 KiB
Go
101 lines
3.6 KiB
Go
package bisect
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var Skip = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Start a git bisect and skip a few commits (selected or current)",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.
|
|
CreateNCommits(10)
|
|
},
|
|
SetupConfig: func(cfg *config.AppConfig) {
|
|
cfg.GetUserConfig().Git.Log.ShowGraph = "never"
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
t.Views().Commits().
|
|
Focus().
|
|
SelectedLine(Contains("commit-10")).
|
|
Press(keys.Commits.ViewBisectOptions).
|
|
Tap(func() {
|
|
t.ExpectPopup().Menu().Title(Equals("Bisect")).Select(MatchesRegexp(`Mark .* as bad`)).Confirm()
|
|
}).
|
|
NavigateToLine(Contains("commit-01")).
|
|
Press(keys.Commits.ViewBisectOptions).
|
|
Tap(func() {
|
|
t.ExpectPopup().Menu().Title(Equals("Bisect")).
|
|
// There's no current commit yet, so the entries act on the
|
|
// selected commit:
|
|
Lines(
|
|
Contains("b Mark commit").Contains("as bad"),
|
|
Contains("g Mark commit").Contains("as good"),
|
|
Contains("s Skip commit"),
|
|
Contains("r Reset bisect"),
|
|
Contains("Cancel"),
|
|
).
|
|
Select(MatchesRegexp(`Mark .* as good`)).Confirm()
|
|
t.Views().Information().Content(Contains("Bisecting"))
|
|
}).
|
|
Lines(
|
|
Contains("CI commit-10").Contains("<-- bad"),
|
|
Contains("CI commit-09").DoesNotContain("<--"),
|
|
Contains("CI commit-08").DoesNotContain("<--"),
|
|
Contains("CI commit-07").DoesNotContain("<--"),
|
|
Contains("CI commit-06").DoesNotContain("<--"),
|
|
Contains("CI commit-05").Contains("<-- current").IsSelected(),
|
|
Contains("CI commit-04").DoesNotContain("<--"),
|
|
Contains("CI commit-03").DoesNotContain("<--"),
|
|
Contains("CI commit-02").DoesNotContain("<--"),
|
|
Contains("CI commit-01").Contains("<-- good"),
|
|
).
|
|
Press(keys.Commits.ViewBisectOptions).
|
|
Tap(func() {
|
|
t.ExpectPopup().Menu().Title(Equals("Bisect")).
|
|
// Does not show a "Skip selected commit" entry:
|
|
Lines(
|
|
Contains("b Mark current commit").Contains("as bad"),
|
|
Contains("g Mark current commit").Contains("as good"),
|
|
Contains("s Skip current commit"),
|
|
Contains("r Reset bisect"),
|
|
Contains("Cancel"),
|
|
).
|
|
Select(Contains("Skip current commit")).Confirm()
|
|
}).
|
|
// Skipping the current commit selects the new current commit:
|
|
Lines(
|
|
Contains("CI commit-10").Contains("<-- bad"),
|
|
Contains("CI commit-09").DoesNotContain("<--"),
|
|
Contains("CI commit-08").DoesNotContain("<--"),
|
|
Contains("CI commit-07").DoesNotContain("<--"),
|
|
Contains("CI commit-06").Contains("<-- current").IsSelected(),
|
|
Contains("CI commit-05").Contains("<-- skipped"),
|
|
Contains("CI commit-04").DoesNotContain("<--"),
|
|
Contains("CI commit-03").DoesNotContain("<--"),
|
|
Contains("CI commit-02").DoesNotContain("<--"),
|
|
Contains("CI commit-01").Contains("<-- good"),
|
|
).
|
|
NavigateToLine(Contains("commit-07")).
|
|
Press(keys.Commits.ViewBisectOptions).
|
|
Tap(func() {
|
|
t.ExpectPopup().Menu().Title(Equals("Bisect")).
|
|
// Does show a "Skip selected commit" entry:
|
|
Lines(
|
|
Contains("b Mark current commit").Contains("as bad"),
|
|
Contains("g Mark current commit").Contains("as good"),
|
|
Contains("s Skip current commit"),
|
|
Contains("S Skip selected commit"),
|
|
Contains("r Reset bisect"),
|
|
Contains("Cancel"),
|
|
).
|
|
Select(Contains("Skip selected commit")).Confirm()
|
|
}).
|
|
// Skipping a selected, non-current commit keeps the selection
|
|
// there:
|
|
SelectedLine(Contains("CI commit-07").Contains("<-- skipped"))
|
|
},
|
|
})
|