File: fixup_second_commit.go

package info (click to toggle)
lazygit 0.57.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,748 kB
  • sloc: sh: 153; makefile: 76
file content (49 lines) | stat: -rw-r--r-- 1,632 bytes parent folder | download | duplicates (2)
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
package interactive_rebase

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

var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
	Description:  "Fixup the second commit into the first (initial)",
	ExtraCmdArgs: []string{},
	Skip:         false,
	SetupConfig:  func(config *config.AppConfig) {},
	SetupRepo: func(shell *Shell) {
		shell.
			CreateFileAndAdd("file1.txt", "File1 Content\n").Commit("First Commit").
			CreateFileAndAdd("file2.txt", "Fixup Content\n").Commit("Fixup Commit Message").
			CreateFileAndAdd("file3.txt", "File3 Content\n").Commit("Third Commit")
	},
	Run: func(t *TestDriver, keys config.KeybindingConfig) {
		t.Views().Commits().
			Focus().
			Lines(
				Contains("Third Commit"),
				Contains("Fixup Commit Message"),
				Contains("First Commit"),
			).
			NavigateToLine(Contains("Fixup Commit Message")).
			Press(keys.Commits.MarkCommitAsFixup).
			Tap(func() {
				t.ExpectPopup().Confirmation().
					Title(Equals("Fixup")).
					Content(Equals("Are you sure you want to 'fixup' the selected commit(s) into the commit below?")).
					Confirm()
			}).
			Lines(
				Contains("Third Commit"),
				Contains("First Commit").IsSelected(),
			)

		t.Views().Main().
			// Make sure that the resulting commit message doesn't contain the
			// message of the fixup commit; compare this to
			// squash_down_second_commit.go, where it does.
			Content(Contains("First Commit")).
			Content(DoesNotContain("Fixup Commit Message")).
			Content(Contains("+File1 Content")).
			Content(Contains("+Fixup Content"))
	},
})