diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go index b8d562dae..d05738ef3 100644 --- a/pkg/commands/git_commands/branch.go +++ b/pkg/commands/git_commands/branch.go @@ -210,7 +210,7 @@ type MergeOpts struct { func (self *BranchCommands) Merge(branchName string, opts MergeOpts) error { cmdArgs := NewGitCmd("merge"). 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"). Arg(branchName). ToArgv() diff --git a/pkg/commands/git_commands/branch_test.go b/pkg/commands/git_commands/branch_test.go index b94f700cc..a6082586c 100644 --- a/pkg/commands/git_commands/branch_test.go +++ b/pkg/commands/git_commands/branch_test.go @@ -127,6 +127,19 @@ func TestBranchMerge(t *testing.T) { branchName: "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", userConfig: &config.UserConfig{},