@@ -45,20 +45,20 @@ func (r *Repository) Diff(rev string, maxFiles, maxFileLines, maxLineChars int,
4545 if commit .ParentsCount () == 0 {
4646 cmd = cmd .AddArgs ("show" ).
4747 AddOptions (opt .CommandOptions ).
48- AddArgs ("--full-index" , rev )
48+ AddArgs ("--full-index" , "--end-of-options" , rev )
4949 } else {
5050 c , err := commit .Parent (0 )
5151 if err != nil {
5252 return nil , err
5353 }
5454 cmd = cmd .AddArgs ("diff" ).
5555 AddOptions (opt .CommandOptions ).
56- AddArgs ("--full-index" , "-M" , c .ID .String (), rev )
56+ AddArgs ("--full-index" , "-M" , c .ID .String (), "--end-of-options" , rev )
5757 }
5858 } else {
5959 cmd = cmd .AddArgs ("diff" ).
6060 AddOptions (opt .CommandOptions ).
61- AddArgs ("--full-index" , "-M" , opt .Base , rev )
61+ AddArgs ("--full-index" , "-M" , opt .Base , "--end-of-options" , rev )
6262 }
6363
6464 stdout , w := io .Pipe ()
@@ -114,29 +114,29 @@ func (r *Repository) RawDiff(rev string, diffType RawDiffFormat, w io.Writer, op
114114 if commit .ParentsCount () == 0 {
115115 cmd = cmd .AddArgs ("show" ).
116116 AddOptions (opt .CommandOptions ).
117- AddArgs ("--full-index" , rev )
117+ AddArgs ("--full-index" , "--end-of-options" , rev )
118118 } else {
119119 c , err := commit .Parent (0 )
120120 if err != nil {
121121 return err
122122 }
123123 cmd = cmd .AddArgs ("diff" ).
124124 AddOptions (opt .CommandOptions ).
125- AddArgs ("--full-index" , "-M" , c .ID .String (), rev )
125+ AddArgs ("--full-index" , "-M" , c .ID .String (), "--end-of-options" , rev )
126126 }
127127 case RawDiffPatch :
128128 if commit .ParentsCount () == 0 {
129129 cmd = cmd .AddArgs ("format-patch" ).
130130 AddOptions (opt .CommandOptions ).
131- AddArgs ("--full-index" , "--no-signoff" , "--no-signature" , "--stdout" , "--root" , rev )
131+ AddArgs ("--full-index" , "--no-signoff" , "--no-signature" , "--stdout" , "--root" , "--end-of-options" , rev )
132132 } else {
133133 c , err := commit .Parent (0 )
134134 if err != nil {
135135 return err
136136 }
137137 cmd = cmd .AddArgs ("format-patch" ).
138138 AddOptions (opt .CommandOptions ).
139- AddArgs ("--full-index" , "--no-signoff" , "--no-signature" , "--stdout" , rev + "..." + c .ID .String ())
139+ AddArgs ("--full-index" , "--no-signoff" , "--no-signature" , "--stdout" , "--end-of-options" , rev + "..." + c .ID .String ())
140140 }
141141 default :
142142 return fmt .Errorf ("invalid diffType: %s" , diffType )
0 commit comments