Skip to content

Commit 6c24c5c

Browse files
pyokagangitster
authored andcommitted
builtin-am: invoke pre-applypatch hook
Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am.sg will invoke the pre-applypatch hook after applying the patch to the index, but before a commit is made. Should the hook exit with a non-zero status, git am will exit. Re-implement this in builtin/am.c. Signed-off-by: Paul Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b8803d8 commit 6c24c5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/am.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,9 @@ static void do_commit(const struct am_state *state)
13341334
const char *reflog_msg, *author;
13351335
struct strbuf sb = STRBUF_INIT;
13361336

1337+
if (run_hook_le(NULL, "pre-applypatch", NULL))
1338+
exit(1);
1339+
13371340
if (write_cache_as_tree(tree, 0, NULL))
13381341
die(_("git write-tree failed to write a tree"));
13391342

0 commit comments

Comments
 (0)