summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/interactive_rebase/interactive_rebase_of_copied_branch.go
blob: 4bb3b86c7b934b47450b7769a4894b1f0ea2844c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package interactive_rebase

import (
	"github.com/jesseduffield/lazygit/pkg/config"
	. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var InteractiveRebaseOfCopiedBranch = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Check that interactively rebasing a branch that is a copy of another branch doesn't affect the original branch",
	ExtraCmdArgs: []string{},
	Skip:         false,
	GitVersion:   AtLeast("2.38.0"),
	SetupConfig: func(config *config.AppConfig) {
		config.AppState.GitLogShowGraph = "never"
	},
	SetupRepo: func(shell *Shell) {
		shell.
			NewBranch("branch1").
			CreateNCommits(3).
			NewBranch("branch2")

		shell.SetConfig("rebase.updateRefs", "true")
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Commits().
			Focus().
			Lines(
				Contains("CI * commit 03"),
				Contains("CI commit 02"),
				Contains("CI commit 01"),
			).
			NavigateToLine(Contains("commit 01")).
			Press(keys.Universal.Edit).
			Lines(
				// No update-ref todo for branch1 here, even though command-line git would have added it
				Contains("pick").Contains("CI commit 03"),
				Contains("pick").Contains("CI commit 02"),
				Contains("CI <-- YOU ARE HERE --- commit 01"),
			)
	},
})