sequencer: run post-commit hook
Prior to commit 356ee4659b ("sequencer: try to commit without forking 'git commit'", 2017-11-24) the sequencer would always run the post-commit hook after each pick or revert as it forked `git commit` to create the commit. The conversion to committing without forking `git commit` omitted to call the post-commit hook after creating the commit. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Oct 15, 2019 at 10:25 UTC
4627bc777e9ade5e3a85d6b8e8630fc4b6e2f8f6
2 files changed
+20
sequencer.c
+1
@@ -1401,6 +1401,7 @@ static int try_to_commit(struct repository *r,
1401
goto out;
1402
}
1403
1404
+ run_commit_hook(0, r->index_file, "post-commit", NULL);
1405
if (flags & AMEND_MSG)
1406
commit_post_rewrite(r, current_head, oid);
1407
t/t3404-rebase-interactive.sh
+19
@@ -1583,6 +1583,25 @@ test_expect_success 'valid author header when author contains single quote' '
1583
test_cmp expected actual
1584
'
1585
1586
+test_expect_success 'post-commit hook is called' '
1587
+ test_when_finished "rm -f .git/hooks/post-commit" &&
1588
+ >actual &&
1589
+ mkdir -p .git/hooks &&
1590
+ write_script .git/hooks/post-commit <<-\EOS &&
1591
+ git rev-parse HEAD >>actual
1592
+ EOS
1593
+ (
1594
+ set_fake_editor &&
1595
+ FAKE_LINES="edit 4 1 reword 2 fixup 3" git rebase -i A E &&
1596
+ echo x>file3 &&
1597
+ git add file3 &&
1598
+ FAKE_COMMIT_MESSAGE=edited git rebase --continue
1599
+ ) &&
1600
+ git rev-parse HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} HEAD@{1} HEAD \
1601
+ >expect &&
1602
+ test_cmp expect actual
1603
+'
1604
+
1605
# This must be the last test in this file
1606
test_expect_success '$EDITOR and friends are unchanged' '
1607
test_editor_unchanged