[PATCH 03/11] reset_head(): don't run checkout hook if there is an error
- From
- Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Oct 1, 2021, 10:04 UTC
- Message-ID
- <28872cbca687b057663a4e3408cb94d69fb60f94.1633082702.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1049.git.1633082702.gitgitgadget@gmail.com>
From: Phillip Wood <phillip.wood@dunelm.org.uk>
The hook should only be run if the worktree and refs were successfully updated.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> --- reset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/reset.c b/reset.c index fc4dae3fd2d..5abb1a5683e 100644 --- a/reset.c +++ b/reset.c @@ -125,7 +125,7 @@ reset_head_refs: ret = create_symref("HEAD", switch_to_branch, reflog_head); } - if (run_hook) + if (!ret && run_hook) run_hook_le(NULL, "post-checkout", oid_to_hex(orig ? orig : null_oid()), oid_to_hex(oid), "1", NULL);
-- gitgitgadget