1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Construct arg vector manually rather than parse string

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
This commit is contained in:
Jesse Duffield
2023-05-21 17:00:29 +10:00
parent 70e473b25d
commit 63dc07fded
221 changed files with 1050 additions and 885 deletions

View File

@ -11,18 +11,18 @@ type Git struct {
}
func (self *Git) CurrentBranchName(expectedName string) *Git {
return self.assert("git rev-parse --abbrev-ref HEAD", expectedName)
return self.assert([]string{"git", "rev-parse", "--abbrev-ref", "HEAD"}, expectedName)
}
func (self *Git) TagNamesAt(ref string, expectedNames []string) *Git {
return self.assert(fmt.Sprintf(`git tag --sort=v:refname --points-at "%s"`, ref), strings.Join(expectedNames, "\n"))
return self.assert([]string{"git", "tag", "--sort=v:refname", "--points-at", ref}, strings.Join(expectedNames, "\n"))
}
func (self *Git) assert(cmdStr string, expected string) *Git {
func (self *Git) assert(cmdArgs []string, expected string) *Git {
self.assertWithRetries(func() (bool, string) {
output, err := self.shell.runCommandWithOutput(cmdStr)
output, err := self.shell.runCommandWithOutput(cmdArgs)
if err != nil {
return false, fmt.Sprintf("Unexpected error running command: `%s`. Error: %s", cmdStr, err.Error())
return false, fmt.Sprintf("Unexpected error running command: `%v`. Error: %s", cmdArgs, err.Error())
}
actual := strings.TrimSpace(output)
return actual == expected, fmt.Sprintf("Expected current branch name to be '%s', but got '%s'", expected, actual)

View File

@ -134,14 +134,14 @@ func buildLazygit() error {
// return nil
osCommand := oscommands.NewDummyOSCommand()
return osCommand.Cmd.New(fmt.Sprintf(
"go build -o %s pkg/integration/clients/injector/main.go", tempLazygitPath(),
)).Run()
return osCommand.Cmd.New([]string{
"go", "build", "-o", tempLazygitPath(), filepath.FromSlash("pkg/integration/clients/injector/main.go"),
}).Run()
}
func createFixture(test *IntegrationTest, paths Paths, rootDir string) error {
shell := NewShell(paths.ActualRepo(), func(errorMsg string) { panic(errorMsg) })
shell.RunCommand("git init -b master")
shell.Init("master")
os.Setenv(GIT_CONFIG_GLOBAL_ENV_VAR, globalGitConfigPath(rootDir))
@ -156,7 +156,7 @@ func globalGitConfigPath(rootDir string) string {
func getGitVersion() (*git_commands.GitVersion, error) {
osCommand := oscommands.NewDummyOSCommand()
cmdObj := osCommand.Cmd.New("git --version")
cmdObj := osCommand.Cmd.New([]string{"git", "--version"})
versionStr, err := cmdObj.RunWithOutput()
if err != nil {
return nil, err
@ -178,9 +178,10 @@ func getLazygitCommand(test *IntegrationTest, paths Paths, rootDir string, sandb
return nil, err
}
cmdStr := fmt.Sprintf("%s -debug --use-config-dir=%s --path=%s %s", tempLazygitPath(), paths.Config(), paths.ActualRepo(), test.ExtraCmdArgs())
cmdArgs := []string{tempLazygitPath(), "-debug", "--use-config-dir=" + paths.Config(), "--path=" + paths.ActualRepo()}
cmdArgs = append(cmdArgs, test.ExtraCmdArgs()...)
cmdObj := osCommand.Cmd.New(cmdStr)
cmdObj := osCommand.Cmd.New(cmdArgs)
cmdObj.AddEnvVars(fmt.Sprintf("%s=%s", TEST_NAME_ENV_VAR, test.Name()))
if sandbox {

View File

@ -2,11 +2,12 @@ package components
import (
"fmt"
"io"
"os"
"path/filepath"
"runtime"
"github.com/jesseduffield/lazygit/pkg/secureexec"
"github.com/mgutz/str"
)
// this is for running shell commands, mostly for the sake of setting up the repo
@ -24,31 +25,25 @@ func NewShell(dir string, fail func(string)) *Shell {
return &Shell{dir: dir, fail: fail}
}
func (self *Shell) RunCommand(cmdStr string) *Shell {
args := str.ToArgv(cmdStr)
cmd := secureexec.Command(args[0], args[1:]...)
cmd.Env = os.Environ()
cmd.Dir = self.dir
output, err := cmd.CombinedOutput()
func (self *Shell) RunCommand(args []string) *Shell {
output, err := self.runCommandWithOutput(args)
if err != nil {
self.fail(fmt.Sprintf("error running command: %s\n%s", cmdStr, string(output)))
self.fail(fmt.Sprintf("error running command: %v\n%s", args, output))
}
return self
}
// Help files are located at test/files from the root the lazygit repo.
// E.g. You may want to create a pre-commit hook file there, then call this
// function to copy it into your test repo.
func (self *Shell) CopyHelpFile(source string, destination string) *Shell {
self.RunCommand(fmt.Sprintf("cp ../../../../../files/%s %s", source, destination))
func (self *Shell) RunCommandExpectError(args []string) *Shell {
output, err := self.runCommandWithOutput(args)
if err == nil {
self.fail(fmt.Sprintf("Expected error running shell command: %v\n%s", args, output))
}
return self
}
func (self *Shell) runCommandWithOutput(cmdStr string) (string, error) {
args := str.ToArgv(cmdStr)
func (self *Shell) runCommandWithOutput(args []string) (string, error) {
cmd := secureexec.Command(args[0], args[1:]...)
cmd.Env = os.Environ()
cmd.Dir = self.dir
@ -59,7 +54,14 @@ func (self *Shell) runCommandWithOutput(cmdStr string) (string, error) {
}
func (self *Shell) RunShellCommand(cmdStr string) *Shell {
cmd := secureexec.Command("sh", "-c", cmdStr)
shell := "sh"
shellArg := "-c"
if runtime.GOOS == "windows" {
shell = "cmd"
shellArg = "/C"
}
cmd := secureexec.Command(shell, shellArg, cmdStr)
cmd.Env = os.Environ()
cmd.Dir = self.dir
@ -71,19 +73,6 @@ func (self *Shell) RunShellCommand(cmdStr string) *Shell {
return self
}
func (self *Shell) RunShellCommandExpectError(cmdStr string) *Shell {
cmd := secureexec.Command("sh", "-c", cmdStr)
cmd.Env = os.Environ()
cmd.Dir = self.dir
output, err := cmd.CombinedOutput()
if err == nil {
self.fail(fmt.Sprintf("Expected error running shell command: %s\n%s", cmdStr, string(output)))
}
return self
}
func (self *Shell) CreateFile(path string, content string) *Shell {
fullPath := filepath.Join(self.dir, path)
err := os.WriteFile(fullPath, []byte(content), 0o644)
@ -124,47 +113,47 @@ func (self *Shell) UpdateFile(path string, content string) *Shell {
}
func (self *Shell) NewBranch(name string) *Shell {
return self.RunCommand("git checkout -b " + name)
return self.RunCommand([]string{"git", "checkout", "-b", name})
}
func (self *Shell) Checkout(name string) *Shell {
return self.RunCommand("git checkout " + name)
return self.RunCommand([]string{"git", "checkout", name})
}
func (self *Shell) Merge(name string) *Shell {
return self.RunCommand("git merge --commit --no-ff " + name)
return self.RunCommand([]string{"git", "merge", "--commit", "--no-ff", name})
}
func (self *Shell) ContinueMerge() *Shell {
return self.RunCommand("git -c core.editor=true merge --continue")
return self.RunCommand([]string{"git", "-c", "core.editor=true", "merge", "--continue"})
}
func (self *Shell) GitAdd(path string) *Shell {
return self.RunCommand(fmt.Sprintf("git add \"%s\"", path))
return self.RunCommand([]string{"git", "add", path})
}
func (self *Shell) GitAddAll() *Shell {
return self.RunCommand("git add -A")
return self.RunCommand([]string{"git", "add", "-A"})
}
func (self *Shell) Commit(message string) *Shell {
return self.RunCommand(fmt.Sprintf("git commit -m \"%s\"", message))
return self.RunCommand([]string{"git", "commit", "-m", message})
}
func (self *Shell) EmptyCommit(message string) *Shell {
return self.RunCommand(fmt.Sprintf("git commit --allow-empty -m \"%s\"", message))
return self.RunCommand([]string{"git", "commit", "--allow-empty", "-m", message})
}
func (self *Shell) Revert(ref string) *Shell {
return self.RunCommand(fmt.Sprintf("git revert %s", ref))
return self.RunCommand([]string{"git", "revert", ref})
}
func (self *Shell) CreateLightweightTag(name string, ref string) *Shell {
return self.RunCommand(fmt.Sprintf("git tag %s %s", name, ref))
return self.RunCommand([]string{"git", "tag", name, ref})
}
func (self *Shell) CreateAnnotatedTag(name string, message string, ref string) *Shell {
return self.RunCommand(fmt.Sprintf("git tag -a %s -m \"%s\" %s", name, message, ref))
return self.RunCommand([]string{"git", "tag", "-a", name, "-m", message, ref})
}
// convenience method for creating a file and adding it
@ -208,60 +197,115 @@ func (self *Shell) CreateNCommitsStartingAt(n, startIndex int) *Shell {
}
func (self *Shell) StashWithMessage(message string) *Shell {
self.RunCommand(fmt.Sprintf(`git stash -m "%s"`, message))
self.RunCommand([]string{"git", "stash", "-m", message})
return self
}
func (self *Shell) SetConfig(key string, value string) *Shell {
self.RunCommand(fmt.Sprintf(`git config --local "%s" "%s"`, key, value))
self.RunCommand([]string{"git", "config", "--local", key, value})
return self
}
// creates a clone of the repo in a sibling directory and adds the clone
// as a remote, then fetches it.
func (self *Shell) CloneIntoRemote(name string) *Shell {
self.Clone(name)
self.RunCommand(fmt.Sprintf("git remote add %s ../%s", name, name))
self.RunCommand(fmt.Sprintf("git fetch %s", name))
self.RunCommand([]string{"git", "remote", "add", name, "../" + name})
self.RunCommand([]string{"git", "fetch", name})
return self
}
func (self *Shell) CloneIntoSubmodule(submoduleName string) *Shell {
self.Clone("other_repo")
self.RunCommand(fmt.Sprintf("git submodule add ../other_repo %s", submoduleName))
self.RunCommand([]string{"git", "submodule", "add", "../other_repo", submoduleName})
return self
}
// clones repo into a sibling directory
func (self *Shell) Clone(repoName string) *Shell {
self.RunCommand(fmt.Sprintf("git clone --bare . ../%s", repoName))
self.RunCommand([]string{"git", "clone", "--bare", ".", "../" + repoName})
return self
}
// e.g. branch: 'master', upstream: 'origin/master'
func (self *Shell) SetBranchUpstream(branch string, upstream string) *Shell {
self.RunCommand(fmt.Sprintf("git branch --set-upstream-to=%s %s", upstream, branch))
self.RunCommand([]string{"git", "branch", "--set-upstream-to=" + upstream, branch})
return self
}
func (self *Shell) RemoveRemoteBranch(remoteName string, branch string) *Shell {
self.RunCommand(fmt.Sprintf("git -C ../%s branch -d %s", remoteName, branch))
self.RunCommand([]string{"git", "-C", "../" + remoteName, "branch", "-d", branch})
return self
}
func (self *Shell) HardReset(ref string) *Shell {
self.RunCommand(fmt.Sprintf("git reset --hard %s", ref))
self.RunCommand([]string{"git", "reset", "--hard", ref})
return self
}
func (self *Shell) Stash(message string) *Shell {
self.RunCommand(fmt.Sprintf("git stash -m \"%s\"", message))
self.RunCommand([]string{"git", "stash", "-m", message})
return self
}
func (self *Shell) StartBisect(good string, bad string) *Shell {
self.RunCommand([]string{"git", "bisect", "start", good, bad})
return self
}
func (self *Shell) Init(mainBranch string) *Shell {
self.RunCommand([]string{"git", "init", "-b", mainBranch})
return self
}
func (self *Shell) MakeExecutable(path string) *Shell {
// 0755 sets the executable permission for owner, and read/execute permissions for group and others
err := os.Chmod(filepath.Join(self.dir, path), 0o755)
if err != nil {
panic(err)
}
return self
}
// Help files are located at test/files from the root the lazygit repo.
// E.g. You may want to create a pre-commit hook file there, then call this
// function to copy it into your test repo.
func (self *Shell) CopyHelpFile(source string, destination string) *Shell {
return self.CopyFile(fmt.Sprintf("../../../../../files/%s", source), destination)
}
func (self *Shell) CopyFile(source string, destination string) *Shell {
absSourcePath := filepath.Join(self.dir, source)
absDestPath := filepath.Join(self.dir, destination)
sourceFile, err := os.Open(absSourcePath)
if err != nil {
self.fail(err.Error())
}
defer sourceFile.Close()
destinationFile, err := os.Create(absDestPath)
if err != nil {
self.fail(err.Error())
}
defer destinationFile.Close()
_, err = io.Copy(destinationFile, sourceFile)
if err != nil {
self.fail(err.Error())
}
// copy permissions to destination file too
sourceFileInfo, err := os.Stat(absSourcePath)
if err != nil {
self.fail(err.Error())
}
err = os.Chmod(absDestPath, sourceFileInfo.Mode())
if err != nil {
self.fail(err.Error())
}
return self
}

View File

@ -22,7 +22,7 @@ const unitTestDescription = "test test"
type IntegrationTest struct {
name string
description string
extraCmdArgs string
extraCmdArgs []string
skip bool
setupRepo func(shell *Shell)
setupConfig func(config *config.AppConfig)
@ -45,7 +45,7 @@ type NewIntegrationTestArgs struct {
// runs the test
Run func(t *TestDriver, keys config.KeybindingConfig)
// additional args passed to lazygit
ExtraCmdArgs string
ExtraCmdArgs []string
// for when a test is flakey
Skip bool
// to run a test only on certain git versions
@ -128,7 +128,7 @@ func (self *IntegrationTest) Description() string {
return self.description
}
func (self *IntegrationTest) ExtraCmdArgs() string {
func (self *IntegrationTest) ExtraCmdArgs() []string {
return self.extraCmdArgs
}

View File

@ -7,7 +7,7 @@ import (
var Basic = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Start a git bisect to find a bad commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.

View File

@ -7,7 +7,7 @@ import (
var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Opening lazygit when bisect has been started from another branch. There's an issue where we don't reselect the current branch if we mark the current branch as bad so this test side-steps that problem",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
@ -15,7 +15,7 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{
NewBranch("other").
CreateNCommits(10).
Checkout("master").
RunCommand("git bisect start other~2 other~5")
StartBisect("other~2", "other~5")
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {

View File

@ -7,7 +7,7 @@ import (
var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Try to checkout branch by name. Verify that it also works on the branch with the special name @.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a new tag on branch",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Delete = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Try to delete the checked out branch first (to no avail), and then delete another branch.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var DetachedHead = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a new branch on detached head",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var OpenWithCliArg = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Open straight to branches panel using a CLI arg",
ExtraCmdArgs: "branch",
ExtraCmdArgs: []string{"branch"},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rebase onto another branch, deal with the conflicts.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rebase onto another branch, deal with the conflicts. Also mark a commit to be dropped before continuing.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RebaseDoesNotAutosquash = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rebase a branch that has fixups onto another branch, and verify that the fixups are not squashed even if rebase.autoSquash is enabled globally.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Reset = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset to another branch",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var ResetUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reset the upstream of a branch",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SetUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Set the upstream of a branch",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checking out a branch with name suggestions",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick commits from the subcommits view, without conflicts",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cherry pick commits from the subcommits view, with conflicts",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Amend = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends the last commit from the files panel",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Commit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files and committing",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with a multi-line commit message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var CommitWipWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with skip hook and config commitPrefix is defined. Prefix is ignored when creating WIP commits.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(testConfig *config.AppConfig) {
testConfig.UserConfig.Git.CommitPrefixes = map[string]config.CommitPrefixConfig{"repo": {Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}

View File

@ -7,7 +7,7 @@ import (
var CommitWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with defined config commitPrefix",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(testConfig *config.AppConfig) {
testConfig.UserConfig.Git.CommitPrefixes = map[string]config.CommitPrefixConfig{"repo": {Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}

View File

@ -7,7 +7,7 @@ import (
var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a new tag on a commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var DiscardOldFileChange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Discarding a single file from an old commit (does rebase in background to remove the file but retain the other one)",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var History = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cycling through commit message history in the commit message panel",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var HistoryComplex = NewIntegrationTest(NewIntegrationTestArgs{
Description: "More complex flow for cycling commit message history",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Creating a new branch from a commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var ResetAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reset author on a commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Revert = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reverts a commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var RevertMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reverts a merge commit and chooses to revert to the parent commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Reword = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files and committing",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Search = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Search for a commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SetAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Set author on a commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var StageRangeOfLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a range of lines",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Staged = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing without pre-commit hooks",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the unstaged files menu, staging a line and committing",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RemoteNamedStar = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Having a config remote.*",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.

View File

@ -8,7 +8,7 @@ import (
var Filter = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensures that when there are merge conflicts, the files panel only shows conflicted files",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var ResolveExternally = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensures that when merge conflicts are resolved outside of lazygit, lazygit prompts you to continue",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var ResolveMultipleFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensures that upon resolving conflicts for one file, the next file is selected",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var UndoChooseHunk = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Chooses a hunk when resolving a merge conflict and then undoes the choice",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var BasicCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command provided at runtime to create a new file",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")

View File

@ -7,7 +7,7 @@ import (
var BasicCmdFromConfig = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command to create a new file",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")

View File

@ -0,0 +1,35 @@
package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ComplexCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command provided at runtime to create a new file, via a shell command. We invoke custom commands through a shell already. This test proves that we can run a shell within a shell, which requires complex escaping.",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsEmpty().
IsFocused().
Press(keys.Universal.ExecuteCustomCommand)
t.ExpectPopup().Prompt().
Title(Equals("Custom Command:")).
Type("sh -c \"touch file.txt\"").
Confirm()
t.GlobalPress(keys.Files.RefreshFiles)
t.Views().Files().
IsFocused().
Lines(
Contains("file.txt"),
)
},
})

View File

@ -7,7 +7,7 @@ import (
var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command reffering prompt responses by name",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")

View File

@ -9,7 +9,7 @@ import (
var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using menuFromCommand prompt type",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.

View File

@ -7,7 +7,7 @@ import (
var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using prompt response in menuFromCommand entries",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.

View File

@ -7,7 +7,7 @@ import (
var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command with multiple prompts",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")

View File

@ -7,7 +7,7 @@ import (
var OmitFromHistory = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Omitting a runtime custom command from history if it begins with space",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")

View File

@ -7,7 +7,7 @@ import (
var Diff = NewIntegrationTest(NewIntegrationTestArgs{
Description: "View the diff of two branches, then view the reverse diff",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a patch from the diff between two branches and apply the patch.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{
Description: "View the diff between two commits",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -13,7 +13,7 @@ var (
var IgnoreWhitespace = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Toggle whitespace in the diff",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -8,7 +8,7 @@ import (
var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{
// notably, we currently _don't_ actually see the untracked file in the diff. Not sure how to get around that.
Description: "When selecting a directory that contains an untracked file, we should not get an error",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Discarding all possible permutations of changed files",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: true, // failing due to index.lock file being created
SetupConfig: func(config *config.AppConfig) {
},
@ -51,7 +51,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{
shell.RunShellCommand(`rm deleted-us.txt && git add deleted-us.txt`)
shell.RunShellCommand(`git commit -m "three"`)
shell.RunShellCommand(`git reset --hard conflict_second`)
shell.RunShellCommandExpectError(`git merge conflict`)
shell.RunCommandExpectError([]string{"git", "merge", "conflict"})
shell.RunShellCommand(`echo "new" > new.txt`)
shell.RunShellCommand(`echo "new staged" > new-staged.txt && git add new-staged.txt`)

View File

@ -7,7 +7,7 @@ import (
var DiscardStagedChanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Discarding staged changes",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},

View File

@ -7,7 +7,7 @@ import (
var Gitignore = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that we can't ignore the .gitignore file, then ignore/exclude other files",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},

View File

@ -14,13 +14,13 @@ fi
var RememberCommitMessageAfterFail = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that the commit message is remembered after a failed attempt at committing",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".git/hooks/pre-commit", preCommitHook)
shell.RunCommand("chmod +x .git/hooks/pre-commit")
shell.MakeExecutable(".git/hooks/pre-commit")
shell.CreateFileAndAdd("one", "one")

View File

@ -7,7 +7,7 @@ import (
var CliArg = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, using CLI arg",
ExtraCmdArgs: "-f filterFile",
ExtraCmdArgs: []string{"-f", "filterFile"},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},

View File

@ -7,7 +7,7 @@ import (
var SelectFile = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, by finding file in UI and filtering on it",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},

View File

@ -7,7 +7,7 @@ import (
var TypeFile = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter commits by file path, by finding file in UI and filtering on it",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},

View File

@ -16,7 +16,7 @@ const (
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: "",
ExtraCmdArgs: []string{},
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.

View File

@ -7,7 +7,7 @@ import (
var AmendFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends a staged file to the first (initial) commit.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var AmendFixupCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends a staged file to a fixup commit, and checks that other unrelated fixup commits are not auto-squashed.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var AmendHeadCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends the current head commit from the commits panel during a rebase.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -12,7 +12,7 @@ var (
var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends a staged file to a merge commit.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var AmendNonHeadCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to amend a commit that is not the head while already rebasing, resulting in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.38.0"),
SetupConfig: func(config *config.AppConfig) {},

View File

@ -7,7 +7,7 @@ import (
var DropTodoCommitWithUpdateRefShowBranchHeads = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file (with experimentalShowBranchHeads on)",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.38.0"),
SetupConfig: func(config *config.AppConfig) {

View File

@ -7,7 +7,7 @@ import (
var EditFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Edits the first commit, just to show that it's possible",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var EditNonTodoCommitDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to edit a non-todo commit while already rebasing, resulting in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var FixupFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to fixup the first commit, which results in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var FixupSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Fixup the second commit into the first (initial)",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Move = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Directly move a commit all the way down and all the way back up",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var MoveInRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Via a single interactive rebase move a commit all the way up then back down then slightly back up again and apply the change",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Begins an interactive rebase, then fixups, drops, and squashes some commits",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -10,7 +10,7 @@ import (
var RewordFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the first commit, just to show that it's possible",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RewordLastCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the last (HEAD) commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RewordYouAreHereCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the current HEAD commit in an interactive rebase",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var RewordYouAreHereCommitWithEditor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Rewords the current HEAD commit in an interactive rebase with editor",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},

View File

@ -7,7 +7,7 @@ import (
var SquashDownFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Tries to squash down the first commit, which results in an error message",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SquashDownSecondCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Squash down the second commit into the first (initial)",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SquashFixupsAboveFirstCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Squashes all fixups above the first (initial) commit.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SwapInRebaseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Via an edit-triggered rebase, swap two commits, causing a conflict. Then resolve the conflict and continue",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var SwapWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Directly swap two commits, causing a conflict. Then resolve the conflict and continue",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Quitting with a confirm prompt",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.UserConfig.ConfirmOnQuit = true

View File

@ -7,7 +7,7 @@ import (
var InitialOpen = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Confirms a popup appears on first opening Lazygit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.UserConfig.DisableStartupPopups = false

View File

@ -7,7 +7,7 @@ import (
var Apply = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Apply a custom patch",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var ApplyInReverse = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Apply a custom patch in reverse",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Apply a custom patch in reverse, resulting in a conflict",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var CopyPatchToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a patch from the commits and copy the patch to clipbaord.",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: true, // skipping because CI doesn't have clipboard functionality
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var MoveToEarlierCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Move a patch from a commit to an earlier commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.26.0"),
SetupConfig: func(config *config.AppConfig) {},

View File

@ -7,7 +7,7 @@ import (
var MoveToEarlierCommitNoKeepEmpty = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Move a patch from a commit to an earlier commit, for older git versions that don't keep the empty commit",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: Before("2.26.0"),
SetupConfig: func(config *config.AppConfig) {},

View File

@ -7,7 +7,7 @@ import (
var MoveToIndex = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Move a patch from a commit to the index",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var MoveToIndexPartOfAdjacentAddedLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Move a patch from a commit to the index, with only some lines of a range of adjacent added lines in the patch",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

View File

@ -7,7 +7,7 @@ import (
var MoveToIndexPartial = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Move a patch from a commit to the index. This is different from the MoveToIndex test in that we're only selecting a partial patch from a file",
ExtraCmdArgs: "",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {

Some files were not shown because too many files have changed in this diff Show More