|
| 1 | +package interactive_rebase |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/jesseduffield/lazygit/pkg/config" |
| 5 | + . "github.com/jesseduffield/lazygit/pkg/integration/components" |
| 6 | +) |
| 7 | + |
| 8 | +var RebaseWithCommitThatBecomesEmpty = NewIntegrationTest(NewIntegrationTestArgs{ |
| 9 | + Description: "Performs a rebase involving a commit that becomes empty during the rebase, and gets dropped.", |
| 10 | + ExtraCmdArgs: []string{}, |
| 11 | + Skip: false, |
| 12 | + SetupConfig: func(config *config.AppConfig) {}, |
| 13 | + SetupRepo: func(shell *Shell) { |
| 14 | + shell.EmptyCommit("initial commit") |
| 15 | + // It is important that we create two separate commits for the two |
| 16 | + // changes to the file, but only one commit for the same changes on our |
| 17 | + // branch; otherwise, the commit would be discarded at the start of the |
| 18 | + // rebase already. |
| 19 | + shell.CreateFileAndAdd("file", "change 1\n") |
| 20 | + shell.Commit("master change 1") |
| 21 | + shell.UpdateFileAndAdd("file", "change 1\nchange 2\n") |
| 22 | + shell.Commit("master change 2") |
| 23 | + shell.NewBranchFrom("branch", "HEAD^^") |
| 24 | + shell.CreateFileAndAdd("file", "change 1\nchange 2\n") |
| 25 | + shell.Commit("branch change") |
| 26 | + }, |
| 27 | + Run: func(t *TestDriver, keys config.KeybindingConfig) { |
| 28 | + t.Views().Branches(). |
| 29 | + Focus(). |
| 30 | + NavigateToLine(Contains("master")). |
| 31 | + Press(keys.Branches.RebaseBranch) |
| 32 | + |
| 33 | + t.ExpectPopup().Menu(). |
| 34 | + Title(Equals("Rebase 'branch'")). |
| 35 | + Select(Contains("Simple rebase")). |
| 36 | + Confirm() |
| 37 | + |
| 38 | + t.Views().Commits(). |
| 39 | + Lines( |
| 40 | + Contains("master change 2"), |
| 41 | + Contains("master change 1"), |
| 42 | + Contains("initial commit"), |
| 43 | + ) |
| 44 | + }, |
| 45 | +}) |
0 commit comments