]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5403-post-checkout-hook.sh
rebase: run post-checkout hook on checkout
[thirdparty/git.git] / t / t5403-post-checkout-hook.sh
index 1d15a1031f9ee2290217a1c42db02ac4e16a9f1c..a539ffc0803a746c70d458a95f27144c9039afff 100755 (executable)
@@ -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 &&