@@ -123,7 +123,7 @@ impl Hooks {
123
123
& self ,
124
124
repo : & git2:: Repository ,
125
125
changed_oids : & [ ( git2:: Oid , git2:: Oid ) ] ,
126
- ) -> Result < ( ) , std :: io :: Error > {
126
+ ) {
127
127
let name = "post-rewrite" ;
128
128
let command = "rebase" ;
129
129
let args = [ command] ;
@@ -133,10 +133,15 @@ impl Hooks {
133
133
writeln ! ( stdin, "{} {}" , old_oid, new_oid) . expect ( "Always writeable" ) ;
134
134
}
135
135
136
- let code = self . run_hook ( repo, name, & args, Some ( stdin. as_bytes ( ) ) , & [ ] ) ?;
137
- log:: trace!( "Hook `{}` failed with code {}" , name, code) ;
138
-
139
- Ok ( ( ) )
136
+ match self . run_hook ( repo, name, & args, Some ( stdin. as_bytes ( ) ) , & [ ] ) {
137
+ Ok ( code) if code != 0 => {
138
+ log:: trace!( "Hook `{}` failed with code {}" , name, code) ;
139
+ }
140
+ Ok ( _) => { }
141
+ Err ( err) => {
142
+ log:: trace!( "Hook `{}` failed with {}" , name, err) ;
143
+ }
144
+ }
140
145
}
141
146
142
147
/// Run `reference-transaction` hook to signal that all reference updates have been queued to the transaction.
@@ -187,7 +192,7 @@ impl Hooks {
187
192
& self ,
188
193
repo : & git2:: Repository ,
189
194
changed_refs : & [ ( git2:: Oid , git2:: Oid , & str ) ] ,
190
- ) -> Result < ( ) , std :: io :: Error > {
195
+ ) {
191
196
let name = "reference-transaction" ;
192
197
let state = "committed" ;
193
198
let args = [ state] ;
@@ -197,10 +202,15 @@ impl Hooks {
197
202
writeln ! ( stdin, "{} {} {}" , old_oid, new_oid, ref_name) . expect ( "Always writeable" ) ;
198
203
}
199
204
200
- let code = self . run_hook ( repo, name, & args, Some ( stdin. as_bytes ( ) ) , & [ ] ) ?;
201
- log:: trace!( "Hook `{}` failed with code {}" , name, code) ;
202
-
203
- Ok ( ( ) )
205
+ match self . run_hook ( repo, name, & args, Some ( stdin. as_bytes ( ) ) , & [ ] ) {
206
+ Ok ( code) if code != 0 => {
207
+ log:: trace!( "Hook `{}` failed with code {}" , name, code) ;
208
+ }
209
+ Ok ( _) => { }
210
+ Err ( err) => {
211
+ log:: trace!( "Hook `{}` failed with {}" , name, err) ;
212
+ }
213
+ }
204
214
}
205
215
206
216
/// Run `reference-transaction` hook to signal that no changes have been made
@@ -213,7 +223,7 @@ impl Hooks {
213
223
& self ,
214
224
repo : & git2:: Repository ,
215
225
changed_refs : & [ ( git2:: Oid , git2:: Oid , & str ) ] ,
216
- ) -> Result < ( ) , std :: io :: Error > {
226
+ ) {
217
227
let name = "reference-transaction" ;
218
228
let state = "aborted" ;
219
229
let args = [ state] ;
@@ -223,10 +233,15 @@ impl Hooks {
223
233
writeln ! ( stdin, "{} {} {}" , old_oid, new_oid, ref_name) . expect ( "Always writeable" ) ;
224
234
}
225
235
226
- let code = self . run_hook ( repo, name, & args, Some ( stdin. as_bytes ( ) ) , & [ ] ) ?;
227
- log:: trace!( "Hook `{}` failed with code {}" , name, code) ;
228
-
229
- Ok ( ( ) )
236
+ match self . run_hook ( repo, name, & args, Some ( stdin. as_bytes ( ) ) , & [ ] ) {
237
+ Ok ( code) if code != 0 => {
238
+ log:: trace!( "Hook `{}` failed with code {}" , name, code) ;
239
+ }
240
+ Ok ( _) => { }
241
+ Err ( err) => {
242
+ log:: trace!( "Hook `{}` failed with {}" , name, err) ;
243
+ }
244
+ }
230
245
}
231
246
}
232
247
0 commit comments