read-cache: convert post-index-change to use hook.h

Move the post-index-change hook away from run-command.h to and over to the new hook.h library. This removes the last direct user of "run_hook_ve()" outside of run-command.c ("run_hook_le()" still uses it). So we can make the function static now. A subsequent commit will remove this code entirely when "run_hook_le()" itself goes away. 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>

Emily Shaffer committed Dec 22, 2021 at 04:59 UTC dbb1c61365baabf4e74c6ef2eee4c4a520056c1d
3 files changed +3 -3
read-cache.c
+2 -1
@@ -28,6 +28,7 @@
28 #include "sparse-index.h"
29 #include "csum-file.h"
30 #include "promisor-remote.h"
31 +#include "hook.h"
32
33 /* Mask for the name length in ce_flags in the on-disk index */
34
@@ -3150,7 +3151,7 @@ static int do_write_locked_index(struct index_state *istate, struct lock_file *l
3151 else
3152 ret = close_lock_file_gently(lock);
3153
3153 - run_hook_le(NULL, "post-index-change",
3154 + run_hooks_l("post-index-change",
3155 istate->updated_workdir ? "1" : "0",
3156 istate->updated_skipworktree ? "1" : "0", NULL);
3157 istate->updated_workdir = 0;
run-command.c
+1 -1
@@ -1313,7 +1313,7 @@ int async_with_fork(void)
1313 #endif
1314 }
1315
1316 -int run_hook_ve(const char *const *env, const char *name, va_list args)
1316 +static int run_hook_ve(const char *const *env, const char *name, va_list args)
1317 {
1318 struct child_process hook = CHILD_PROCESS_INIT;
1319 const char *p;
run-command.h
-1
@@ -235,7 +235,6 @@ int run_command(struct child_process *);
235 */
236 LAST_ARG_MUST_BE_NULL
237 int run_hook_le(const char *const *env, const char *name, ...);
238 -int run_hook_ve(const char *const *env, const char *name, va_list args);
238
239 /*
240 * Trigger an auto-gc