1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-29 23:17:32 +02:00

Add test for editing several commits right after a merge commit

This is very similar to edit_range_select_outside_rebase.go, except that it
selects commits right after, and including, a merge commit.

This test already works correctly. The reason we add it is that we are going to
have two different implementations of the `e` command depending on whether the
last selected commit is a merge commit, and we want to make sure they both work
with a range selection.
This commit is contained in:
Stefan Haller 2024-11-29 16:49:18 +01:00
parent 0766b14afd
commit 016d46526c
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,43 @@
package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var EditRangeSelectDownToMergeOutsideRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Select a range of commits (the last one being a merge commit) to edit outside of a rebase",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.22.0"), // first version that supports the --rebase-merges option
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeCommit(shell)
shell.CreateNCommits(2)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
TopLines(
Contains("CI ◯ commit 02").IsSelected(),
Contains("CI ◯ commit 01"),
Contains("Merge branch 'second-change-branch' into first-change-branch"),
).
Press(keys.Universal.RangeSelectDown).
Press(keys.Universal.RangeSelectDown).
Press(keys.Universal.Edit).
Lines(
Contains("edit CI commit 02").IsSelected(),
Contains("edit CI commit 01").IsSelected(),
Contains(" CI ⏣─╮ <-- YOU ARE HERE --- Merge branch 'second-change-branch' into first-change-branch").IsSelected(),
Contains(" CI │ ◯ * second-change-branch unrelated change"),
Contains(" CI │ ◯ second change"),
Contains(" CI ◯ │ first change"),
Contains(" CI ◯─╯ * original"),
Contains(" CI ◯ three"),
Contains(" CI ◯ two"),
Contains(" CI ◯ one"),
)
},
})

View File

@ -214,6 +214,7 @@ var tests = []*components.IntegrationTest{
interactive_rebase.EditFirstCommit,
interactive_rebase.EditLastCommitOfStackedBranch,
interactive_rebase.EditNonTodoCommitDuringRebase,
interactive_rebase.EditRangeSelectDownToMergeOutsideRebase,
interactive_rebase.EditRangeSelectOutsideRebase,
interactive_rebase.EditTheConflCommit,
interactive_rebase.FixupFirstCommit,