From 5d48c0eb2d45cbda04be846dc86ea7a75208c10e Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 2 Feb 2024 21:24:13 -0300 Subject: [PATCH] only forward git flags if they are set. --- send.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/send.go b/send.go index bbe8753..5135a9f 100644 --- a/send.go +++ b/send.go @@ -61,11 +61,13 @@ var send = &cli.Command{ // git-format-patch extra flags that will be handled directly to it gitFormatPatchArgs := []string{"format-patch", "--stdout"} for _, fd := range gitFormatPatchFlags { - switch flag := fd.(type) { - case *cli.StringFlag: - gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name+"="+c.String(flag.Name)) - case *cli.BoolFlag: - gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name) + if fd.IsSet() { + switch flag := fd.(type) { + case *cli.StringFlag: + gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name+"="+c.String(flag.Name)) + case *cli.BoolFlag: + gitFormatPatchArgs = append(gitFormatPatchArgs, "--"+flag.Name) + } } }