Merge branch 'js/rebase-merge-octopus'
[gitweb.git] / t / t5516-fetch-push.sh
index f4d28288f070c131ed4bbe1d38c12eb61dc57973..bd8f23e4300218fba33a5bea5effa167a2e9155a 100755 (executable)
@@ -923,7 +923,7 @@ test_expect_success 'push into aliased refs (consistent)' '
        (
                cd child1 &&
                git branch foo &&
-               git symbolic-ref refs/heads/bar refs/heads/foo
+               git symbolic-ref refs/heads/bar refs/heads/foo &&
                git config receive.denyCurrentBranch false
        ) &&
        (
@@ -945,7 +945,7 @@ test_expect_success 'push into aliased refs (inconsistent)' '
        (
                cd child1 &&
                git branch foo &&
-               git symbolic-ref refs/heads/bar refs/heads/foo
+               git symbolic-ref refs/heads/bar refs/heads/foo &&
                git config receive.denyCurrentBranch false
        ) &&
        (
@@ -1011,7 +1011,7 @@ test_expect_success 'push --porcelain rejected' '
        mk_empty testrepo &&
        git push testrepo refs/heads/master:refs/remotes/origin/master &&
        (cd testrepo &&
-               git reset --hard origin/master^
+               git reset --hard origin/master^ &&
                git config receive.denyCurrentBranch true) &&
 
        echo >.git/foo  "To testrepo"  &&
@@ -1025,7 +1025,7 @@ test_expect_success 'push --porcelain --dry-run rejected' '
        mk_empty testrepo &&
        git push testrepo refs/heads/master:refs/remotes/origin/master &&
        (cd testrepo &&
-               git reset --hard origin/master
+               git reset --hard origin/master &&
                git config receive.denyCurrentBranch true) &&
 
        echo >.git/foo  "To testrepo"  &&
@@ -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" '
@@ -1314,7 +1333,7 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
                git commit --allow-empty -m "future commit" &&
                git tag -m "future" future &&
                git checkout master &&
-               git for-each-ref refs/heads/master refs/tags/tag >../expect
+               git for-each-ref refs/heads/master refs/tags/tag >../expect &&
                git push --follow-tag ../dst master
        ) &&
        (