|
| 1 | +package patch_building |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/jesseduffield/lazygit/pkg/config" |
| 5 | + . "github.com/jesseduffield/lazygit/pkg/integration/components" |
| 6 | +) |
| 7 | + |
| 8 | +var MoveToNewCommitInLastCommitOfStackedBranch = NewIntegrationTest(NewIntegrationTestArgs{ |
| 9 | + Description: "Move a patch from a commit to a new commit, in the last commit of a branch in the middle of a stack", |
| 10 | + ExtraCmdArgs: []string{}, |
| 11 | + Skip: false, |
| 12 | + GitVersion: AtLeast("2.38.0"), |
| 13 | + SetupConfig: func(config *config.AppConfig) { |
| 14 | + config.GetAppState().GitLogShowGraph = "never" |
| 15 | + }, |
| 16 | + SetupRepo: func(shell *Shell) { |
| 17 | + shell. |
| 18 | + EmptyCommit("commit 01"). |
| 19 | + NewBranch("branch1"). |
| 20 | + EmptyCommit("commit 02"). |
| 21 | + CreateFileAndAdd("file1", "file1 content"). |
| 22 | + CreateFileAndAdd("file2", "file2 content"). |
| 23 | + Commit("commit 03"). |
| 24 | + NewBranch("branch2"). |
| 25 | + CreateNCommitsStartingAt(2, 4) |
| 26 | + |
| 27 | + shell.SetConfig("rebase.updateRefs", "true") |
| 28 | + }, |
| 29 | + Run: func(t *TestDriver, keys config.KeybindingConfig) { |
| 30 | + t.Views().Commits(). |
| 31 | + Focus(). |
| 32 | + Lines( |
| 33 | + Contains("CI commit 05").IsSelected(), |
| 34 | + Contains("CI commit 04"), |
| 35 | + Contains("CI * commit 03"), |
| 36 | + Contains("CI commit 02"), |
| 37 | + Contains("CI commit 01"), |
| 38 | + ). |
| 39 | + NavigateToLine(Contains("commit 03")). |
| 40 | + PressEnter() |
| 41 | + |
| 42 | + t.Views().CommitFiles(). |
| 43 | + IsFocused(). |
| 44 | + Lines( |
| 45 | + Equals("▼ /").IsSelected(), |
| 46 | + Equals(" A file1"), |
| 47 | + Equals(" A file2"), |
| 48 | + ). |
| 49 | + SelectNextItem(). |
| 50 | + PressPrimaryAction(). |
| 51 | + PressEscape() |
| 52 | + |
| 53 | + t.Views().Information().Content(Contains("Building patch")) |
| 54 | + |
| 55 | + t.Common().SelectPatchOption(Contains("Move patch into new commit")) |
| 56 | + |
| 57 | + t.ExpectPopup().CommitMessagePanel(). |
| 58 | + InitialText(Equals("")). |
| 59 | + Type("new commit").Confirm() |
| 60 | + |
| 61 | + t.Views().Commits(). |
| 62 | + IsFocused(). |
| 63 | + Lines( |
| 64 | + Contains("CI commit 05"), |
| 65 | + Contains("CI commit 04"), |
| 66 | + Contains("CI * new commit").IsSelected(), |
| 67 | + Contains("CI commit 03"), |
| 68 | + Contains("CI commit 02"), |
| 69 | + Contains("CI commit 01"), |
| 70 | + ) |
| 71 | + }, |
| 72 | +}) |
0 commit comments