t1450: make hash size independent
[gitweb.git] / t / t5403-post-checkout-hook.sh
index 1d15a1031f9ee2290217a1c42db02ac4e16a9f1c..a39b3b5c78bc900ae4e9c629598381f915d291de 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,10 +46,28 @@ 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 &&
-       echo "$@" >$GIT_DIR/post-checkout.args
+       echo "$@" >"$GIT_DIR/post-checkout.args"
        EOF
        git clone --template=templates . clone3 &&
        test -f clone3/.git/post-checkout.args