diff options
author | Emily Shaffer <emilyshaffer@google.com> | 2021-12-22 04:59:42 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-07 15:19:35 -0800 |
commit | 306f445ed16065dfd03553c8a990037b2daf4f05 (patch) | |
tree | a5d34ecf41527140050709e828cbb144b830a2c4 /builtin/receive-pack.c | |
parent | dbb1c61365baabf4e74c6ef2eee4c4a520056c1d (diff) | |
download | git-306f445ed16065dfd03553c8a990037b2daf4f05.tar.gz |
receive-pack: convert push-to-checkout hook to hook.h
Move the push-to-checkout hook away from run-command.h to and over to
the new hook.h library.
This removes the last direct user of run_hook_le(), so we could remove
that function now, but let's leave that to a follow-up cleanup commit.
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r-- | builtin/receive-pack.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 4f92e6f059..e99b1ecd10 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1424,9 +1424,12 @@ static const char *push_to_checkout(unsigned char *hash, struct strvec *env, const char *work_tree) { + struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT; + strvec_pushf(env, "GIT_WORK_TREE=%s", absolute_path(work_tree)); - if (run_hook_le(env->v, push_to_checkout_hook, - hash_to_hex(hash), NULL)) + strvec_pushv(&opt.env, env->v); + strvec_push(&opt.args, hash_to_hex(hash)); + if (run_hooks_opt(push_to_checkout_hook, &opt)) return "push-to-checkout hook declined"; else return NULL; |