File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 11package git
22
33import (
4+ "strings"
5+
46 "github.com/spf13/pflag"
57)
68
@@ -76,8 +78,23 @@ func (o *Options) Combine(filename string) []string {
7678 combination = append (combination , "--dry-run" )
7779 }
7880 if len (o .ExtraGitFlags ) > 0 {
79- combination = append (combination , o .ExtraGitFlags ... )
81+ result := deDuplicateFlag (o .ExtraGitFlags , "-F" , "--file" )
82+ combination = append (combination , result ... )
8083 }
8184
8285 return combination
83- }
86+ }
87+
88+ func deDuplicateFlag (sli []string , short , long string ) []string {
89+ var result []string
90+ for _ , s := range sli {
91+ if strings .HasPrefix (s , short ) {
92+ continue
93+ }
94+ if strings .HasPrefix (s , long ) {
95+ continue
96+ }
97+ result = append (result , s )
98+ }
99+ return result
100+ }
You can’t perform that action at this time.
0 commit comments