Skip to content

Commit

Permalink
Don't run post-update hook unless a ref changed
Browse files Browse the repository at this point in the history
There is little point in executing the post-update hook if all refs
had an error and were unable to be updated.  In this case nothing
new is reachable within the repository, and there is no state change
for the post-update hook to be interested in.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Mar 7, 2007
1 parent 8e663d9 commit 3e6e152
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ static void run_update_post_hook(struct command *cmd)
int argc;
const char **argv;

if (access(update_post_hook, X_OK) < 0)
return;
for (argc = 1, cmd_p = cmd; cmd_p; cmd_p = cmd_p->next) {
for (argc = 0, cmd_p = cmd; cmd_p; cmd_p = cmd_p->next) {
if (cmd_p->error_string)
continue;
argc++;
}
argv = xmalloc(sizeof(*argv) * (1 + argc));
if (!argc || access(update_post_hook, X_OK) < 0)
return;
argv = xmalloc(sizeof(*argv) * (2 + argc));
argv[0] = update_post_hook;

for (argc = 1, cmd_p = cmd; cmd_p; cmd_p = cmd_p->next) {
Expand Down

0 comments on commit 3e6e152

Please sign in to comment.