@@ -445,9 +445,12 @@ static void am_destroy(const struct am_state *state)
static int run_applypatch_msg_hook(struct am_state *state)
{
int ret;
+ struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT;
assert(state->msg);
- ret = run_hook_le(NULL, "applypatch-msg", am_path(state, "final-commit"), NULL);
+ strvec_push(&opt.args, am_path(state, "final-commit"));
+ ret = run_hooks("applypatch-msg", &opt);
+ run_hooks_opt_clear(&opt);
if (!ret) {
FREE_AND_NULL(state->msg);
@@ -1607,9 +1610,13 @@ static void do_commit(const struct am_state *state)
struct commit_list *parents = NULL;
const char *reflog_msg, *author, *committer = NULL;
struct strbuf sb = STRBUF_INIT;
+ struct run_hooks_opt hook_opt_pre = RUN_HOOKS_OPT_INIT;
+ struct run_hooks_opt hook_opt_post = RUN_HOOKS_OPT_INIT;
- if (run_hook_le(NULL, "pre-applypatch", NULL))
+ if (run_hooks("pre-applypatch", &hook_opt_pre)) {
+ run_hooks_opt_clear(&hook_opt_pre);
exit(1);
+ }
if (write_cache_as_tree(&tree, 0, NULL))
die(_("git write-tree failed to write a tree"));
@@ -1660,8 +1667,10 @@ static void do_commit(const struct am_state *state)
fclose(fp);
}
- run_hook_le(NULL, "post-applypatch", NULL);
+ run_hooks("post-applypatch", &hook_opt_post);
+ run_hooks_opt_clear(&hook_opt_pre);
+ run_hooks_opt_clear(&hook_opt_post);
strbuf_release(&sb);
}