@@ -45,7 +45,10 @@ func (r *Repository) Diff(rev string, maxFiles, maxFileLines, maxLineChars int,
45
45
AddOptions (opt .CommandOptions ).
46
46
AddArgs ("--full-index" , rev )
47
47
} else {
48
- c , _ := commit .Parent (0 )
48
+ c , err := commit .Parent (0 )
49
+ if err != nil {
50
+ return nil , err
51
+ }
49
52
cmd = cmd .AddArgs ("diff" ).
50
53
AddOptions (opt .CommandOptions ).
51
54
AddArgs ("--full-index" , "-M" , c .ID .String (), rev )
@@ -111,7 +114,10 @@ func (r *Repository) RawDiff(rev string, diffType RawDiffFormat, w io.Writer, op
111
114
AddOptions (opt .CommandOptions ).
112
115
AddArgs ("--full-index" , rev )
113
116
} else {
114
- c , _ := commit .Parent (0 )
117
+ c , err := commit .Parent (0 )
118
+ if err != nil {
119
+ return err
120
+ }
115
121
cmd = cmd .AddArgs ("diff" ).
116
122
AddOptions (opt .CommandOptions ).
117
123
AddArgs ("--full-index" , "-M" , c .ID .String (), rev )
@@ -122,7 +128,10 @@ func (r *Repository) RawDiff(rev string, diffType RawDiffFormat, w io.Writer, op
122
128
AddOptions (opt .CommandOptions ).
123
129
AddArgs ("--full-index" , "--no-signature" , "--stdout" , "--root" , rev )
124
130
} else {
125
- c , _ := commit .Parent (0 )
131
+ c , err := commit .Parent (0 )
132
+ if err != nil {
133
+ return err
134
+ }
126
135
cmd = cmd .AddArgs ("format-patch" ).
127
136
AddOptions (opt .CommandOptions ).
128
137
AddArgs ("--full-index" , "--no-signature" , "--stdout" , rev + "..." + c .ID .String ())
0 commit comments