Skip to content

Commit 8637a21

Browse files
treelinelabskoraktor
authored andcommitted
Display output of pre-commit hook
1 parent 8591eff commit 8637a21

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

PBGitIndex.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,13 @@ - (void)commitWithMessage:(NSString *)commitMessage
177177
int ret = 1;
178178

179179
[self postCommitUpdate:@"Running hooks"];
180-
if (![repository executeHook:@"pre-commit" output:nil])
181-
return [self postCommitFailure:@"Pre-commit hook failed"];
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];
186+
}
182187

183188
if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil])
184189
return [self postCommitFailure:@"Commit-msg hook failed"];

0 commit comments

Comments
 (0)