mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-02-20 01:02:29 +08:00
I've optimised for muscle memory backwards compatibility here: - Outside interactive rebase: press 'f' then instead of a confirmation panel, a menu appears where you can choose to keep the selected commit's message - Inside interactive rebase: press 'f' then press 'c' to see the menu for keeping the message, where if you press 'c' again it will retain the current message. so 'fcc' is the chord to press. We're also now showing the -C flag (which is what enables the behaviour) against the todo. I've picked the 'c' keybinding because 'C' was taken and it corresponds to the flag. Previously that showed a warning about a change in keybinding for cherry picking but it's been ages since we've made that change so I'm happy to retire it.
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
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().Menu().
|
|
Title(Equals("Fixup")).
|
|
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"))
|
|
},
|
|
})
|