diff options
Diffstat (limited to 'receive-pack.c')
-rw-r--r-- | receive-pack.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/receive-pack.c b/receive-pack.c index ff746e7d56..675c88f492 100644 --- a/receive-pack.c +++ b/receive-pack.c @@ -68,6 +68,8 @@ struct command { static struct command *commands; static const char update_hook[] = "hooks/update"; +static const char pre_receive_hook[] = "hooks/pre-receive"; +static const char post_receive_hook[] = "hooks/post-receive"; static int run_hook(const char *hook_name, struct command *first_cmd, @@ -236,6 +238,14 @@ static void execute_commands(const char *unpacker_error) return; } + if (run_hook(pre_receive_hook, commands, 0)) { + while (cmd) { + cmd->error_string = "pre-receive hook declined"; + cmd = cmd->next; + } + return; + } + while (cmd) { cmd->error_string = update(cmd); cmd = cmd->next; @@ -483,6 +493,7 @@ int main(int argc, char **argv) unlink(pack_lockfile); if (report_status) report(unpack_status); + run_hook(post_receive_hook, commands, 0); run_update_post_hook(commands); } return 0; |