aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-02-17 15:25:57 -0800
committerJunio C Hamano <gitster@pobox.com>2013-02-17 15:25:57 -0800
commitce735bf7fd66c6404e86e5a313f35abc0394b838 (patch)
treeac1605c58fb6a3b12c90a4085cc6a0a7ada64da9 /t
parentabea4dc76a675d4ac0f27a2367256dc31981d1ca (diff)
parentdaebaa78137d59693a808c1f0bdec0ecb40fc12e (diff)
downloadgit-ce735bf7fd66c6404e86e5a313f35abc0394b838.tar.gz
git-ce735bf7fd66c6404e86e5a313f35abc0394b838.tar.xz
Merge branch 'jc/hidden-refs'
Allow the server side to redact the refs/ namespace it shows to the client. Will merge to 'master'. * jc/hidden-refs: upload/receive-pack: allow hiding ref hierarchies upload-pack: simplify request validation upload-pack: share more code
Diffstat (limited to 't')
-rwxr-xr-xt/t5512-ls-remote.sh12
-rwxr-xr-xt/t5516-fetch-push.sh27
2 files changed, 39 insertions, 0 deletions
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index d16e5d384..321c3e523 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -126,4 +126,16 @@ test_expect_success 'Report match with --exit-code' '
test_cmp expect actual
'
+for configsection in transfer uploadpack
+do
+ test_expect_success "Hide some refs with $configsection.hiderefs" '
+ test_config $configsection.hiderefs refs/tags &&
+ git ls-remote . >actual &&
+ test_unconfig $configsection.hiderefs &&
+ git ls-remote . |
+ sed -e "/ refs\/tags\//d" >expect &&
+ test_cmp expect actual
+ '
+done
+
test_done
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 8f024a08f..c31e5c1c5 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -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