summaryrefslogtreecommitdiff
path: root/t/t5403-post-checkout-hook.sh
diff options
context:
space:
mode:
authorOrgad Shaneh <orgads@gmail.com>2018-12-29 21:37:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-02 21:18:33 (GMT)
commit8581df65ec961aa59004f2d6342709b25d7b79c4 (patch)
tree38ec95a5ed0b6af2ce78bff3f58e513a23dda1c6 /t/t5403-post-checkout-hook.sh
parent10499a9d586b3fba4ea6f67cd0b391b9e7048f34 (diff)
downloadgit-8581df65ec961aa59004f2d6342709b25d7b79c4.zip
git-8581df65ec961aa59004f2d6342709b25d7b79c4.tar.gz
git-8581df65ec961aa59004f2d6342709b25d7b79c4.tar.bz2
rebase: run post-checkout hook on checkout
The scripted version of rebase used to run this hook on the initial checkout. The transition to built-in introduced a regression. Signed-off-by: Orgad Shaneh <orgads@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5403-post-checkout-hook.sh')
-rwxr-xr-xt/t5403-post-checkout-hook.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index 1d15a10..a539ffc 100755
--- a/t/t5403-post-checkout-hook.sh
+++ b/t/t5403-post-checkout-hook.sh
@@ -13,6 +13,8 @@ test_expect_success setup '
EOF
test_commit one &&
test_commit two &&
+ test_commit rebase-on-me &&
+ git reset --hard HEAD^ &&
test_commit three
'
@@ -44,6 +46,24 @@ test_expect_success 'post-checkout receives the right args when not switching br
test $old = $new && test $flag = 0
'
+test_expect_success 'post-checkout is triggered on rebase' '
+ test_when_finished "rm -f .git/post-checkout.args" &&
+ git checkout -b rebase-test master &&
+ rm -f .git/post-checkout.args &&
+ git rebase rebase-on-me &&
+ read old new flag <.git/post-checkout.args &&
+ test $old != $new && test $flag = 1
+'
+
+test_expect_success 'post-checkout is triggered on rebase with fast-forward' '
+ test_when_finished "rm -f .git/post-checkout.args" &&
+ git checkout -b ff-rebase-test rebase-on-me^ &&
+ rm -f .git/post-checkout.args &&
+ git rebase rebase-on-me &&
+ read old new flag <.git/post-checkout.args &&
+ test $old != $new && test $flag = 1
+'
+
test_expect_success 'post-checkout hook is triggered by clone' '
mkdir -p templates/hooks &&
write_script templates/hooks/post-checkout <<-\EOF &&