mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-19 17:02:18 +03:00
By constructing an arg vector manually, we no longer need to quote arguments Mandate that args must be passed when building a command Now you need to provide an args array when building a command. There are a handful of places where we need to deal with a string, such as with user-defined custom commands, and for those we now require that at the callsite they use str.ToArgv to do that. I don't want to provide a method out of the box for it because I want to discourage its use. For some reason we were invoking a command through a shell when amending a commit, and I don't believe we needed to do that as there was nothing user- supplied about the command. So I've switched to using a regular command out- side the shell there
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
package commit
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var HistoryComplex = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "More complex flow for cycling commit message history",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.EmptyCommit("initial commit")
|
|
shell.EmptyCommit("commit 2")
|
|
shell.EmptyCommit("commit 3")
|
|
|
|
shell.CreateFileAndAdd("myfile", "myfile content")
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
// We're going to start a new commit message,
|
|
// then leave and try to reword a commit, then
|
|
// come back to original message and confirm we haven't lost our message.
|
|
// This shows that we're storing the preserved message for a new commit separately
|
|
// to the message when cycling history.
|
|
|
|
t.Views().Files().
|
|
IsFocused().
|
|
Press(keys.Files.CommitChanges)
|
|
|
|
t.ExpectPopup().CommitMessagePanel().
|
|
InitialText(Equals("")).
|
|
Type("my commit message").
|
|
Cancel()
|
|
|
|
t.Views().Commits().
|
|
Focus().
|
|
SelectedLine(Contains("commit 3")).
|
|
Press(keys.Commits.RenameCommit)
|
|
|
|
t.ExpectPopup().CommitMessagePanel().
|
|
InitialText(Equals("commit 3")).
|
|
SelectNextMessage().
|
|
Content(Equals("")).
|
|
Type("reworded message").
|
|
SelectPreviousMessage().
|
|
Content(Equals("commit 3")).
|
|
SelectNextMessage().
|
|
Content(Equals("reworded message")).
|
|
Cancel()
|
|
|
|
t.Views().Files().
|
|
Focus().
|
|
Press(keys.Files.CommitChanges)
|
|
|
|
t.ExpectPopup().CommitMessagePanel().
|
|
InitialText(Equals("my commit message"))
|
|
},
|
|
})
|