Skip to content

Commit 72ddf34

Browse files
nasamuffingitster
authored andcommitted
hooks: convert non-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, except in the case of builtin/worktree.c. That special-case will be handled in a subsequent commit. Signed-off-by: Emily Shaffer <[email protected]> Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Acked-by: Emily Shaffer <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 67ad630 commit 72ddf34

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

builtin/checkout.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "config.h"
1010
#include "diff.h"
1111
#include "dir.h"
12+
#include "hook.h"
1213
#include "ll-merge.h"
1314
#include "lockfile.h"
1415
#include "merge-recursive.h"
@@ -114,7 +115,7 @@ static void branch_info_release(struct branch_info *info)
114115
static int post_checkout_hook(struct commit *old_commit, struct commit *new_commit,
115116
int changed)
116117
{
117-
return run_hook_le(NULL, "post-checkout",
118+
return run_hooks_l("post-checkout",
118119
oid_to_hex(old_commit ? &old_commit->object.oid : null_oid()),
119120
oid_to_hex(new_commit ? &new_commit->object.oid : null_oid()),
120121
changed ? "1" : "0", NULL);

builtin/clone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "connected.h"
3333
#include "packfile.h"
3434
#include "list-objects-filter-options.h"
35+
#include "hook.h"
3536

3637
/*
3738
* Overall FIXMEs:
@@ -705,7 +706,7 @@ static int checkout(int submodule_progress)
705706
if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
706707
die(_("unable to write new index file"));
707708

708-
err |= run_hook_le(NULL, "post-checkout", oid_to_hex(null_oid()),
709+
err |= run_hooks_l("post-checkout", oid_to_hex(null_oid()),
709710
oid_to_hex(&oid), "1", NULL);
710711

711712
if (!err && (option_recurse_submodules.nr > 0)) {

reset.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "tree-walk.h"
88
#include "tree.h"
99
#include "unpack-trees.h"
10+
#include "hook.h"
1011

1112
int reset_head(struct repository *r, struct object_id *oid, const char *action,
1213
const char *switch_to_branch, unsigned flags,
@@ -127,7 +128,7 @@ int reset_head(struct repository *r, struct object_id *oid, const char *action,
127128
reflog_head);
128129
}
129130
if (run_hook)
130-
run_hook_le(NULL, "post-checkout",
131+
run_hooks_l("post-checkout",
131132
oid_to_hex(orig ? orig : null_oid()),
132133
oid_to_hex(oid), "1", NULL);
133134

0 commit comments

Comments
 (0)