mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
Allow more than one argument in git.merging.args config (#3336)
- **PR Description**
Fix a bug where merging would fail with an error message when you try to
put more than one argument in the `git.merging.args` config. This broke
with 25f8b0337e
.
Fixes #3334.
This commit is contained in:
commit
e9b04b8cfc
2 changed files with 14 additions and 1 deletions
|
@ -210,7 +210,7 @@ type MergeOpts struct {
|
||||||
func (self *BranchCommands) Merge(branchName string, opts MergeOpts) error {
|
func (self *BranchCommands) Merge(branchName string, opts MergeOpts) error {
|
||||||
cmdArgs := NewGitCmd("merge").
|
cmdArgs := NewGitCmd("merge").
|
||||||
Arg("--no-edit").
|
Arg("--no-edit").
|
||||||
ArgIf(self.UserConfig.Git.Merging.Args != "", self.UserConfig.Git.Merging.Args).
|
Arg(strings.Fields(self.UserConfig.Git.Merging.Args)...).
|
||||||
ArgIf(opts.FastForwardOnly, "--ff-only").
|
ArgIf(opts.FastForwardOnly, "--ff-only").
|
||||||
Arg(branchName).
|
Arg(branchName).
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
|
@ -127,6 +127,19 @@ func TestBranchMerge(t *testing.T) {
|
||||||
branchName: "mybranch",
|
branchName: "mybranch",
|
||||||
expected: []string{"merge", "--no-edit", "--merging-args", "mybranch"},
|
expected: []string{"merge", "--no-edit", "--merging-args", "mybranch"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
testName: "multiple merging args",
|
||||||
|
userConfig: &config.UserConfig{
|
||||||
|
Git: config.GitConfig{
|
||||||
|
Merging: config.MergingConfig{
|
||||||
|
Args: "--arg1 --arg2", // it's up to the user what they put here
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts: MergeOpts{},
|
||||||
|
branchName: "mybranch",
|
||||||
|
expected: []string{"merge", "--no-edit", "--arg1", "--arg2", "mybranch"},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
testName: "fast forward only",
|
testName: "fast forward only",
|
||||||
userConfig: &config.UserConfig{},
|
userConfig: &config.UserConfig{},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue