Skip to content

Commit bc70e56

Browse files
committed
[git] Fix forwarding empty arguments
Fixes mislav#2552 Ref. d99f308
1 parent 6c63f56 commit bc70e56

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

commands/args.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ func (a *Args) ToCmd() *cmd.Cmd {
9292
}
9393

9494
for _, arg := range a.Params {
95-
if arg != "" {
96-
c.WithArg(arg)
97-
}
95+
c.WithArg(arg)
9896
}
9997

10098
return c

commands/args_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ func TestArgs_GlobalFlags_Replaced(t *testing.T) {
120120
assert.Equal(t, []string{"-a", "http://example.com"}, cmd.Args)
121121
}
122122

123+
func TestArgs_ToCmd(t *testing.T) {
124+
args := NewArgs([]string{"a", "", "b", ""})
125+
cmd := args.ToCmd()
126+
assert.Equal(t, []string{"a", "", "b", ""}, cmd.Args)
127+
}
128+
123129
func TestArgs_GlobalFlags_BeforeAfterChain(t *testing.T) {
124130
args := NewArgs([]string{"-c", "key=value", "-C", "dir", "status"})
125131
args.Before("git", "remote", "add")

0 commit comments

Comments
 (0)