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 1
1
package git
2
2
3
3
import (
4
+ "strings"
5
+
4
6
"github.com/spf13/pflag"
5
7
)
6
8
@@ -76,8 +78,23 @@ func (o *Options) Combine(filename string) []string {
76
78
combination = append (combination , "--dry-run" )
77
79
}
78
80
if len (o .ExtraGitFlags ) > 0 {
79
- combination = append (combination , o .ExtraGitFlags ... )
81
+ result := deDuplicateFlag (o .ExtraGitFlags , "-F" , "--file" )
82
+ combination = append (combination , result ... )
80
83
}
81
84
82
85
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