diff options
author | Emily Shaffer <emilyshaffer@google.com> | 2021-12-22 03:59:36 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-07 23:19:34 (GMT) |
commit | 1a3017d908824ab42ca7a5af7073f4cdc5c88fbf (patch) | |
tree | 1b6711e0a4033c7688eca8e909b307f8ea7e0f43 /hook.h | |
parent | 72ddf34d7c62a0b272d5cdd8f62fcfc782bb3a45 (diff) | |
download | git-1a3017d908824ab42ca7a5af7073f4cdc5c88fbf.zip git-1a3017d908824ab42ca7a5af7073f4cdc5c88fbf.tar.gz git-1a3017d908824ab42ca7a5af7073f4cdc5c88fbf.tar.bz2 |
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>
Diffstat (limited to 'hook.h')
-rw-r--r-- | hook.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -12,6 +12,12 @@ struct run_hooks_opt /* Emit an error if the hook is missing */ unsigned int error_if_missing:1; + + /** + * An optional initial working directory for the hook, + * translates to "struct child_process"'s "dir" member. + */ + const char *dir; }; #define RUN_HOOKS_OPT_INIT { \ |