summaryrefslogtreecommitdiff
path: root/receive-pack.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-03-07 16:50:43 -0500
committerJunio C Hamano <junkio@cox.net>2007-03-07 14:45:42 -0800
commit3e6e152c7496c1acd298ec2b916d62acb56f11c0 (patch)
tree50ed503b0f9fd8f20c8dc79645f0be6d50f7838a /receive-pack.c
parent8e663d9e90d3d9efc9bb99ad597a6819efe625ce (diff)
downloadgit-3e6e152c7496c1acd298ec2b916d62acb56f11c0.tar.gz
Don't run post-update hook unless a ref changed
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>
Diffstat (limited to 'receive-pack.c')
-rw-r--r--receive-pack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/receive-pack.c b/receive-pack.c
index d39aebac1e..e32e301d47 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -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) {