t/Makefile: fix result handling with TEST_OUTPUT_DIRECTORY
[gitweb.git] / t / t5516-fetch-push.sh
index 8f024a08f0b175c12747c33ac0a07cacb73937d9..9a21cd61d7c5efa13990e474d6c5f1ba0e939b71 100755 (executable)
@@ -230,10 +230,10 @@ test_expect_success 'push with pushInsteadOf' '
 
 test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' '
        mk_empty &&
-       TRASH="$(pwd)/" &&
-       git config "url.trash2/.pushInsteadOf" trash/ &&
+       git config "url.trash2/.pushInsteadOf" testrepo/ &&
+       git config "url.trash3/.pusnInsteadOf" trash/wrong &&
        git config remote.r.url trash/wrong &&
-       git config remote.r.pushurl "$TRASH/testrepo" &&
+       git config remote.r.pushurl "testrepo/" &&
        git push r refs/heads/master:refs/remotes/origin/master &&
        (
                cd testrepo &&
@@ -1016,4 +1016,31 @@ test_expect_success 'push --prune refspec' '
        ! check_push_result $the_first_commit tmp/foo tmp/bar
 '
 
+for configsection in transfer receive
+do
+       test_expect_success "push to update a ref hidden by $configsection.hiderefs" '
+               mk_test heads/master hidden/one hidden/two hidden/three &&
+               (
+                       cd testrepo &&
+                       git config $configsection.hiderefs refs/hidden
+               ) &&
+
+               # push to unhidden ref succeeds normally
+               git push testrepo master:refs/heads/master &&
+               check_push_result $the_commit heads/master &&
+
+               # push to update a hidden ref should fail
+               test_must_fail git push testrepo master:refs/hidden/one &&
+               check_push_result $the_first_commit hidden/one &&
+
+               # push to delete a hidden ref should fail
+               test_must_fail git push testrepo :refs/hidden/two &&
+               check_push_result $the_first_commit hidden/two &&
+
+               # idempotent push to update a hidden ref should fail
+               test_must_fail git push testrepo $the_first_commit:refs/hidden/three &&
+               check_push_result $the_first_commit hidden/three
+       '
+done
+
 test_done