@@ -239,31 +239,35 @@ impl CommitComponent {
239
239
& mut self ,
240
240
msg : String ,
241
241
) -> Result < CommitResult > {
242
- if !self . verify {
243
- self . do_commit ( & msg) ?;
244
- self . verify = true ;
245
- return Ok ( CommitResult :: ComitDone ) ;
246
- }
247
- if let HookResult :: NotOk ( e) =
248
- sync:: hooks_pre_commit ( & self . repo . borrow ( ) ) ?
249
- {
250
- log:: error!( "pre-commit hook error: {}" , e) ;
251
- self . queue . push ( InternalEvent :: ShowErrorMsg ( format ! (
252
- "pre-commit hook error:\n {e}"
253
- ) ) ) ;
254
- return Ok ( CommitResult :: Aborted ) ;
242
+ // on exit verify should always be on
243
+ let verify = self . verify ;
244
+ self . verify = true ;
245
+
246
+ if verify {
247
+ // run pre commit hook - can reject commit
248
+ if let HookResult :: NotOk ( e) =
249
+ sync:: hooks_pre_commit ( & self . repo . borrow ( ) ) ?
250
+ {
251
+ log:: error!( "pre-commit hook error: {}" , e) ;
252
+ self . queue . push ( InternalEvent :: ShowErrorMsg (
253
+ format ! ( "pre-commit hook error:\n {e}" ) ,
254
+ ) ) ;
255
+ return Ok ( CommitResult :: Aborted ) ;
256
+ }
255
257
}
256
258
let mut msg = message_prettify ( msg, Some ( b'#' ) ) ?;
257
- if let HookResult :: NotOk ( e) =
258
- sync:: hooks_commit_msg ( & self . repo . borrow ( ) , & mut msg) ?
259
- {
260
- log:: error!( "commit-msg hook error: {}" , e) ;
261
- self . queue . push ( InternalEvent :: ShowErrorMsg ( format ! (
262
- "commit-msg hook error:\n {e}"
263
- ) ) ) ;
264
- return Ok ( CommitResult :: Aborted ) ;
259
+ if verify {
260
+ // run commit message check hook - can reject commit
261
+ if let HookResult :: NotOk ( e) =
262
+ sync:: hooks_commit_msg ( & self . repo . borrow ( ) , & mut msg) ?
263
+ {
264
+ log:: error!( "commit-msg hook error: {}" , e) ;
265
+ self . queue . push ( InternalEvent :: ShowErrorMsg (
266
+ format ! ( "commit-msg hook error:\n {e}" ) ,
267
+ ) ) ;
268
+ return Ok ( CommitResult :: Aborted ) ;
269
+ }
265
270
}
266
-
267
271
self . do_commit ( & msg) ?;
268
272
269
273
if let HookResult :: NotOk ( e) =
0 commit comments