File tree 1 file changed +15
-8
lines changed 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -177,16 +177,23 @@ - (void)commitWithMessage:(NSString *)commitMessage
177
177
int ret = 1 ;
178
178
179
179
[self postCommitUpdate: @" Running hooks" ];
180
- NSString *preCommitHookOutput = nil ;
181
- if (![repository executeHook: @" pre-commit " output: &preCommitHookOutput]) {
182
- NSString *preCommitFailureMessage = [ NSString stringWithFormat :@" Pre -commit hook failed %@%@ " ,
183
- [preCommitHookOutput length ] > 0 ? @" : \n " : @" " ,
184
- preCommitHookOutput];
185
- return [ self postCommitFailure: preCommitFailureMessage ];
180
+ NSString *hookFailureMessage = nil ;
181
+ NSString *hookOutput = nil ;
182
+ if (![repository executeHook :@" pre -commit" output: &hookOutput]) {
183
+ hookFailureMessage = [ NSString stringWithFormat: @" Pre-commit hook failed %@%@ " ,
184
+ [hookOutput length ] > 0 ? @" : \n " : @" " ,
185
+ hookOutput ];
186
186
}
187
187
188
- if (![repository executeHook: @" commit-msg" withArgs: [NSArray arrayWithObject: commitMessageFile] output: nil ])
189
- return [self postCommitFailure: @" Commit-msg hook failed" ];
188
+ if (![repository executeHook: @" commit-msg" withArgs: [NSArray arrayWithObject: commitMessageFile] output: nil ]) {
189
+ hookFailureMessage = [NSString stringWithFormat: @" Commit-msg hook failed%@%@ " ,
190
+ [hookOutput length ] > 0 ? @" :\n " : @" " ,
191
+ hookOutput];
192
+ }
193
+
194
+ if (hookFailureMessage != nil ) {
195
+ return [self postCommitFailure: hookFailureMessage];
196
+ }
190
197
191
198
commitMessage = [NSString stringWithContentsOfFile: commitMessageFile encoding: NSUTF8StringEncoding error: nil ];
192
199
You can’t perform that action at this time.
0 commit comments