]> Kevux Git Server - rit/commit
hooks: convert worktree 'post-checkout' hook to hook library
authorEmily Shaffer <emilyshaffer@google.com>
Wed, 22 Dec 2021 03:59:36 +0000 (04:59 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Jan 2022 23:19:34 +0000 (15:19 -0800)
commit1a3017d908824ab42ca7a5af7073f4cdc5c88fbf
tree1b6711e0a4033c7688eca8e909b307f8ea7e0f43
parent72ddf34d7c62a0b272d5cdd8f62fcfc782bb3a45
hooks: convert worktree 'post-checkout' hook to hook library

Move the running of the 'post-checkout' hook away from run-command.h
to the new hook.h library in builtin/worktree.c. For this special case
we need a change to the hook API to teach it to run the hook from a
given directory.

We cannot skip the "absolute_path" flag and just check if "dir" is
specified as we'd then fail to find our hook in the new dir we'd
chdir() to. We currently don't have a use-case for running a hook not
in our "base" repository at a given absolute path, so let's have "dir"
imply absolute_path(find_hook(hook_name)).

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>
builtin/worktree.c
hook.c
hook.h