diff options
Diffstat (limited to 'pkg/integration')
5 files changed, 111 insertions, 93 deletions
diff --git a/pkg/integration/tests/bisect/basic.go b/pkg/integration/tests/bisect/basic.go index e17f0d50f..1dfe6368b 100644 --- a/pkg/integration/tests/bisect/basic.go +++ b/pkg/integration/tests/bisect/basic.go @@ -11,6 +11,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ Skip: false, SetupRepo: func(shell *Shell) { shell. + NewBranch("mybranch"). CreateNCommits(10) }, SetupConfig: func(cfg *config.AppConfig) {}, @@ -31,20 +32,21 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Commits(). Focus(). - SelectedLine(Contains("commit 10")). - NavigateToLine(Contains("commit 09")). + SelectedLine(Contains("CI commit 10")). + NavigateToLine(Contains("CI commit 09")). Tap(func() { markCommitAsBad() t.Views().Information().Content(Contains("Bisecting")) }). SelectedLine(Contains("<-- bad")). - NavigateToLine(Contains("commit 02")). + NavigateToLine(Contains("CI commit 02")). Tap(markCommitAsGood). + TopLines(Contains("CI commit 10")). // lazygit will land us in the commit between our good and bad commits. - SelectedLine(Contains("commit 05").Contains("<-- current")). + SelectedLine(Contains("CI commit 05").Contains("<-- current")). Tap(markCommitAsBad). - SelectedLine(Contains("commit 04").Contains("<-- current")). + SelectedLine(Contains("CI commit 04").Contains("<-- current")). Tap(func() { markCommitAsGood() @@ -52,7 +54,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{ t.ExpectPopup().Alert().Title(Equals("Bisect complete")).Content(MatchesRegexp("(?s)commit 05.*Do you want to reset")).Confirm() }). IsFocused(). - Content(Contains("commit 04")) + Content(Contains("CI commit 04")) t.Views().Information().Content(DoesNotContain("Bisecting")) }, diff --git a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go b/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go index 4bd738d6a..3fa221d72 100644 --- a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go +++ b/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go @@ -10,12 +10,16 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{ ExtraCmdArgs: []string{}, Skip: false, GitVersion: AtLeast("2.38.0"), - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Git.MainBranches = []string{"master"} + }, SetupRepo: func(shell *Shell) { shell. - CreateNCommits(3). - NewBranch("mybranch"). - CreateNCommitsStartingAt(3, 4) + CreateNCommits(1). + NewBranch("branch1"). + CreateNCommitsStartingAt(3, 2). + NewBranch("branch2"). + CreateNCommitsStartingAt(3, 5) shell.SetConfig("rebase.updateRefs", "true") }, @@ -23,26 +27,28 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Commits(). Focus(). Lines( - Contains("commit 06").IsSelected(), - Contains("commit 05"), - Contains("commit 04"), - Contains("commit 03"), - Contains("commit 02"), - Contains("commit 01"), + Contains("CI commit 07").IsSelected(), + Contains("CI commit 06"), + Contains("CI commit 05"), + Contains("CI * commit 04"), + Contains("CI commit 03"), + Contains("CI commit 02"), + Contains("CI commit 01"), ). - NavigateToLine(Contains("commit 01")). + NavigateToLine(Contains("commit 02")). Press(keys.Universal.Edit). Focus(). Lines( - Contains("pick").Contains("commit 06"), - Contains("pick").Contains("commit 05"), - Contains("pick").Contains("commit 04"), - Contains("update-ref").Contains("master"), - Contains("pick").Contains("commit 03"), - Contains("pick").Contains("commit 02"), - Contains("<-- YOU ARE HERE --- commit 01"), + Contains("pick").Contains("CI commit 07"), + Contains("pick").Contains("CI commit 06"), + Contains("pick").Contains("CI commit 05"), + Contains("update-ref").Contains("branch1").DoesNotContain("*"), + Contains("pick").Contains("CI * commit 04"), + Contains("pick").Contains("CI commit 03"), + Contains("<-- YOU ARE HERE --- commit 02"), + Contains("CI commit 01"), ). - NavigateToLine(Contains("commit 05")). + NavigateToLine(Contains("commit 06")). Press(keys.Universal.Remove) t.Common().ContinueRebase() @@ -50,11 +56,12 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Commits(). IsFocused(). Lines( - Contains("commit 06"), - Contains("commit 04"), - Contains("commit 03"), - Contains("commit 02"), - Contains("commit 01"), + Contains("CI commit 07"), + Contains("CI commit 05"), + Contains("CI * commit 04"), + Contains("CI commit 03"), + Contains("CI commit 02"), + Contains("CI commit 01"), ) }, }) diff --git a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref_show_branch_heads.go b/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref_show_branch_heads.go deleted file mode 100644 index b8cd41055..000000000 --- a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref_show_branch_heads.go +++ /dev/null @@ -1,62 +0,0 @@ -package interactive_rebase - -import ( - "github.com/jesseduffield/lazygit/pkg/config" - . "github.com/jesseduffield/lazygit/pkg/integration/components" -) - -var DropTodoCommitWithUpdateRefShowBranchHeads = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file (with experimentalShowBranchHeads on)", - ExtraCmdArgs: []string{}, - Skip: false, - GitVersion: AtLeast("2.38.0"), - SetupConfig: func(config *config.AppConfig) { - config.UserConfig.Gui.ExperimentalShowBranchHeads = true - }, - SetupRepo: func(shell *Shell) { - shell. - CreateNCommits(3). - NewBranch("mybranch"). - CreateNCommitsStartingAt(3, 4) - - shell.SetConfig("rebase.updateRefs", "true") - }, - Run: func(t *TestDriver, keys config.KeybindingConfig) { - t.Views().Commits(). - Focus(). - Lines( - Contains("(*) commit 06").IsSelected(), - Contains("commit 05"), - Contains("commit 04"), - Contains("(*) commit 03"), - Contains("commit 02"), - Contains("commit 01"), - ). - NavigateToLine(Contains("commit 01")). - Press(keys.Universal.Edit). - Focus(). - Lines( - Contains("pick").Contains("(*) commit 06"), - Contains("pick").Contains("commit 05"), - Contains("pick").Contains("commit 04"), - Contains("update-ref").Contains("master"), - Contains("pick").Contains("(*) commit 03"), - Contains("pick").Contains("commit 02"), - Contains("<-- YOU ARE HERE --- commit 01"), - ). - NavigateToLine(Contains("commit 05")). - Press(keys.Universal.Remove) - - t.Common().ContinueRebase() - - t.Views().Commits(). - IsFocused(). - Lines( - Contains("(*) commit 06"), - Contains("commit 04"), - Contains("(*) commit 03"), - Contains("commit 02"), - Contains("commit 01"), - ) - }, -}) diff --git a/pkg/integration/tests/reflog/do_not_show_branch_markers_in_reflog_subcommits.go b/pkg/integration/tests/reflog/do_not_show_branch_markers_in_reflog_subcommits.go new file mode 100644 index 000000000..8e888c95a --- /dev/null +++ b/pkg/integration/tests/reflog/do_not_show_branch_markers_in_reflog_subcommits.go @@ -0,0 +1,71 @@ +package reflog + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var DoNotShowBranchMarkersInReflogSubcommits = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Verify that no branch heads are shown in the subcommits view of a reflog entry", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.NewBranch("branch1") + shell.EmptyCommit("one") + shell.EmptyCommit("two") + shell.NewBranch("branch2") + shell.EmptyCommit("three") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + // Check that the local commits view does show a branch marker for branch1 + t.Views().Commits(). + Lines( + Contains("CI three"), + Contains("CI * two"), + Contains("CI one"), + ) + + t.Views().Branches(). + Focus(). + // Check out branch1 + NavigateToLine(Contains("branch1")). + PressPrimaryAction(). + // Look at the subcommits of branch2 + NavigateToLine(Contains("branch2")). + PressEnter(). + // Check that we see a marker for branch1 here (but not for + // branch2), even though branch1 is checked out + Tap(func() { + t.Views().SubCommits(). + IsFocused(). + Lines( + Contains("CI three"), + Contains("CI * two"), + Contains("CI one"), + ). + PressEscape() + }). + // Check out branch2 again + NavigateToLine(Contains("branch2")). + PressPrimaryAction() + + t.Views().ReflogCommits(). + Focus(). + TopLines( + Contains("checkout: moving from branch1 to branch2").IsSelected(), + ). + PressEnter(). + // Check that the subcommits view for a reflog entry doesn't show + // any branch markers + Tap(func() { + t.Views().SubCommits(). + IsFocused(). + Lines( + Contains("CI three"), + Contains("CI two"), + Contains("CI one"), + ) + }) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index bdd2a2bfd..9dcb57dee 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -117,7 +117,6 @@ var tests = []*components.IntegrationTest{ interactive_rebase.AmendMerge, interactive_rebase.AmendNonHeadCommitDuringRebase, interactive_rebase.DropTodoCommitWithUpdateRef, - interactive_rebase.DropTodoCommitWithUpdateRefShowBranchHeads, interactive_rebase.DropWithCustomCommentChar, interactive_rebase.EditFirstCommit, interactive_rebase.EditNonTodoCommitDuringRebase, @@ -164,6 +163,7 @@ var tests = []*components.IntegrationTest{ patch_building.StartNewPatch, reflog.Checkout, reflog.CherryPick, + reflog.DoNotShowBranchMarkersInReflogSubcommits, reflog.Patch, reflog.Reset, staging.DiffContextChange, |