sha1-file.c: mark more strings for translation
[gitweb.git] / t / t5516-fetch-push.sh
index d9c90f2ba57d67fda1db86c8cc56dfecb806ee92..a5077d8b7c596523a3b0e0e5e45385e5d7871b9e 100755 (executable)
@@ -94,6 +94,9 @@ mk_child() {
 }
 
 check_push_result () {
+       test $# -ge 3 ||
+       error "bug in the test script: check_push_result requires at least 3 parameters"
+
        repo_name="$1"
        shift
 
@@ -553,10 +556,7 @@ test_expect_success 'branch.*.pushremote config order is irrelevant' '
 test_expect_success 'push with dry-run' '
 
        mk_test testrepo heads/master &&
-       (
-               cd testrepo &&
-               old_commit=$(git show-ref -s --verify refs/heads/master)
-       ) &&
+       old_commit=$(git -C testrepo show-ref -s --verify refs/heads/master) &&
        git push --dry-run testrepo : &&
        check_push_result testrepo $old_commit heads/master
 '
@@ -612,7 +612,7 @@ test_expect_success 'push does not update local refs on failure' '
        chmod +x testrepo/.git/hooks/pre-receive &&
        (
                cd child &&
-               git pull .. master
+               git pull .. master &&
                test_must_fail git push &&
                test $(git rev-parse master) != \
                        $(git rev-parse remotes/origin/master)
@@ -1121,6 +1121,25 @@ test_expect_success 'fetch exact SHA1' '
        )
 '
 
+test_expect_success 'fetch exact SHA1 in protocol v2' '
+       mk_test testrepo heads/master hidden/one &&
+       git push testrepo master:refs/hidden/one &&
+       git -C testrepo config transfer.hiderefs refs/hidden &&
+       check_push_result testrepo $the_commit hidden/one &&
+
+       mk_child testrepo child &&
+       git -C child config protocol.version 2 &&
+
+       # make sure $the_commit does not exist here
+       git -C child repack -a -d &&
+       git -C child prune &&
+       test_must_fail git -C child cat-file -t $the_commit &&
+
+       # fetching the hidden object succeeds by default
+       # NEEDSWORK: should this match the v0 behavior instead?
+       git -C child fetch -v ../testrepo $the_commit:refs/heads/copy
+'
+
 for configallowtipsha1inwant in true false
 do
        test_expect_success "shallow fetch reachable SHA1 (but not a ref), allowtipsha1inwant=$configallowtipsha1inwant" '