By using hook.h instead of run-command.h to run hooks, pre-rebase hooks can now be specified in the config as well as in the hookdir. pre-rebase is not called anywhere besides builtin/rebase.c. Signed-off-by: Emily Shaffer <emilyshaffer@xxxxxxxxxx> --- Documentation/githooks.txt | 2 ++ builtin/rebase.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index d74308dc20..5dc0690607 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -200,6 +200,8 @@ two parameters. The first parameter is the upstream from which the series was forked. The second parameter is the branch being rebased, and is not set when rebasing the current branch. +Hooks executed during 'pre-rebase' will run in parallel by default. + post-checkout ~~~~~~~~~~~~~ diff --git a/builtin/rebase.c b/builtin/rebase.c index 19c7b377aa..f61ca3e5af 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -28,6 +28,7 @@ #include "sequencer.h" #include "rebase-interactive.h" #include "reset.h" +#include "hook.h" #define DEFAULT_REFLOG_ACTION "rebase" @@ -1312,6 +1313,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) char *squash_onto_name = NULL; int reschedule_failed_exec = -1; int allow_preemptive_ff = 1; + struct run_hooks_opt hook_opt = RUN_HOOKS_OPT_INIT_ASYNC; struct option builtin_rebase_options[] = { OPT_STRING(0, "onto", &options.onto_name, N_("revision"), @@ -2024,9 +2026,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) } /* If a hook exists, give it a chance to interrupt*/ + strvec_pushl(&hook_opt.args, options.upstream_arg, argc ? argv[0] : NULL, NULL); if (!ok_to_skip_pre_rebase && - run_hook_le(NULL, "pre-rebase", options.upstream_arg, - argc ? argv[0] : NULL, NULL)) + run_hooks("pre-rebase", &hook_opt)) die(_("The pre-rebase hook refused to rebase.")); if (options.flags & REBASE_DIFFSTAT) { @@ -2106,6 +2108,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) ret = !!run_specific_rebase(&options, action); cleanup: + run_hooks_opt_clear(&hook_opt); strbuf_release(&buf); strbuf_release(&revisions); free(options.head_name); -- 2.28.0.rc0.142.g3c755180ce-goog