mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-22 15:22:51 +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
66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
package interactive_rebase
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
const (
|
|
BASE_BRANCH = "base-branch"
|
|
TOP_BRANCH = "top-branch"
|
|
BASE_COMMIT = "base-commit"
|
|
TOP_COMMIT = "top-commit"
|
|
)
|
|
|
|
var AdvancedInteractiveRebase = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "It begins an interactive rebase and verifies to have the possibility of editing the commits of the branch before proceeding with the actual rebase",
|
|
ExtraCmdArgs: []string{},
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.
|
|
NewBranch(BASE_BRANCH).
|
|
EmptyCommit(BASE_COMMIT).
|
|
NewBranch(TOP_BRANCH).
|
|
EmptyCommit(TOP_COMMIT)
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
t.Views().Commits().
|
|
Focus().
|
|
Lines(
|
|
Contains(TOP_COMMIT),
|
|
Contains(BASE_COMMIT),
|
|
)
|
|
|
|
t.Views().Branches().
|
|
Focus().
|
|
NavigateToLine(Contains(BASE_BRANCH)).
|
|
Press(keys.Branches.RebaseBranch)
|
|
|
|
t.ExpectPopup().Menu().
|
|
Title(Equals(fmt.Sprintf("Rebase '%s' onto '%s'", TOP_BRANCH, BASE_BRANCH))).
|
|
Select(Contains("interactive rebase")).
|
|
Confirm()
|
|
t.Views().Commits().
|
|
IsFocused().
|
|
Lines(
|
|
Contains(TOP_COMMIT),
|
|
Contains(BASE_COMMIT).Contains("YOU ARE HERE"),
|
|
).
|
|
NavigateToLine(Contains(TOP_COMMIT)).
|
|
Press(keys.Universal.Edit).
|
|
Lines(
|
|
Contains(TOP_COMMIT).Contains("edit"),
|
|
Contains(BASE_COMMIT).Contains("YOU ARE HERE"),
|
|
).
|
|
Tap(func() {
|
|
t.Common().ContinueRebase()
|
|
}).
|
|
Lines(
|
|
Contains(TOP_COMMIT).Contains("YOU ARE HERE"),
|
|
Contains(BASE_COMMIT),
|
|
)
|
|
},
|
|
})
|