2023-02-19 12:33:58 +02:00
|
|
|
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)",
|
2023-05-21 09:00:29 +02:00
|
|
|
ExtraCmdArgs: []string{},
|
2023-02-19 12:33:58 +02:00
|
|
|
Skip: false,
|
|
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
|
|
SetupRepo: func(shell *Shell) {
|
|
|
|
shell.
|
2023-02-25 18:44:43 +02:00
|
|
|
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")
|
2023-02-19 12:33:58 +02:00
|
|
|
},
|
|
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
|
|
t.Views().Commits().
|
|
|
|
Focus().
|
|
|
|
Lines(
|
2023-02-25 18:44:43 +02:00
|
|
|
Contains("Third Commit"),
|
|
|
|
Contains("Fixup Commit Message"),
|
|
|
|
Contains("First Commit"),
|
2023-02-19 12:33:58 +02:00
|
|
|
).
|
2023-02-25 18:44:43 +02:00
|
|
|
NavigateToLine(Contains("Fixup Commit Message")).
|
2023-02-19 12:33:58 +02:00
|
|
|
Press(keys.Commits.MarkCommitAsFixup).
|
|
|
|
Tap(func() {
|
|
|
|
t.ExpectPopup().Confirmation().
|
|
|
|
Title(Equals("Fixup")).
|
|
|
|
Content(Equals("Are you sure you want to 'fixup' this commit? It will be merged into the commit below")).
|
|
|
|
Confirm()
|
|
|
|
}).
|
|
|
|
Lines(
|
2023-02-25 18:44:43 +02:00
|
|
|
Contains("Third Commit"),
|
|
|
|
Contains("First Commit").IsSelected(),
|
2023-02-19 12:33:58 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
t.Views().Main().
|
2023-02-25 18:44:43 +02:00
|
|
|
// 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"))
|
2023-02-19 12:33:58 +02:00
|
|
|
},
|
|
|
|
})
|