summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/interactive_rebase/drop_commit_in_copied_branch_with_update_ref.go
blob: 8ea13c6e271d67714cc20c68e5b80c5da2539575 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package interactive_rebase

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

var DropCommitInCopiedBranchWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Drops a commit in a branch that is a copy of another branch, and verify that the other branch is left alone",
	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").IsSelected(),
				Contains("CI commit 02"),
				Contains("CI commit 01"),
			).
			NavigateToLine(Contains("commit 02")).
			Press(keys.Universal.Remove).
			Tap(func() {
				t.ExpectPopup().Confirmation().
					Title(Equals("Drop commit")).
					Content(Equals("Are you sure you want to drop the selected commit(s)?")).
					Confirm()
			}).
			Lines(
				Contains("CI commit 03"), // no start on this commit because branch1 is no longer pointing to it
				Contains("CI commit 01"),
			)

		t.Views().Branches().
			Focus().
			NavigateToLine(Contains("branch1")).
			PressPrimaryAction()

		t.Views().Commits().Lines(
			Contains("CI commit 03"),
			Contains("CI commit 02"),
			Contains("CI commit 01"),
		)
	},
})