test_expect_success 'clone with path bundle' '
git clone --bundle-uri="clone-from/B.bundle" \
clone-from clone-path &&
- git -C clone-path rev-parse refs/bundles/topic >actual &&
+ git -C clone-path rev-parse refs/bundles/heads/topic >actual &&
git -C clone-from rev-parse topic >expect &&
test_cmp expect actual
'
git clone --bundle-uri="clone-from/bad-header.bundle" \
clone-from clone-bad-header 2>err &&
commit_b=$(git -C clone-from rev-parse B) &&
- test_grep "trying to write ref '\''refs/bundles/topic'\'' with nonexistent object $commit_b" err &&
+ test_grep "trying to write ref '\''refs/bundles/heads/topic'\'' with nonexistent object $commit_b" err &&
git -C clone-bad-header for-each-ref --format="%(refname)" >refs &&
- test_grep ! "refs/bundles/" refs
+ test_grep ! "refs/bundles/heads/" refs
'
test_expect_success 'clone with bundle that has bad object' '
git clone --bundle-uri="clone-from/bad-object.bundle" \
clone-from clone-bad-object-no-fsck &&
git -C clone-bad-object-no-fsck for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
- test_write_lines refs/bundles/bad >expect &&
+ grep "refs/bundles/heads/" refs >actual &&
+ test_write_lines refs/bundles/heads/bad >expect &&
test_cmp expect actual &&
# Unbundle fails with fsckObjects set true, but clone can still proceed.
clone-from clone-bad-object-fsck 2>err &&
test_grep "missingEmail" err &&
git -C clone-bad-object-fsck for-each-ref --format="%(refname)" >refs &&
- test_grep ! "refs/bundles/" refs
+ test_grep ! "refs/bundles/heads/" refs
'
test_expect_success 'clone with path bundle and non-default hash' '
test_when_finished "rm -rf clone-path-non-default-hash" &&
GIT_DEFAULT_HASH=sha256 git clone --bundle-uri="clone-from/B.bundle" \
clone-from clone-path-non-default-hash &&
- git -C clone-path-non-default-hash rev-parse refs/bundles/topic >actual &&
+ git -C clone-path-non-default-hash rev-parse refs/bundles/heads/topic >actual &&
git -C clone-from rev-parse topic >expect &&
test_cmp expect actual
'
test_expect_success 'clone with file:// bundle' '
git clone --bundle-uri="file://$(pwd)/clone-from/B.bundle" \
clone-from clone-file &&
- git -C clone-file rev-parse refs/bundles/topic >actual &&
+ git -C clone-file rev-parse refs/bundles/heads/topic >actual &&
git -C clone-from rev-parse topic >expect &&
test_cmp expect actual
'
git -C clone-list-file cat-file --batch-check <oids &&
git -C clone-list-file for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
+ grep "refs/bundles/heads/" refs >actual &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/merge
- refs/bundles/right
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/merge
+ refs/bundles/heads/right
EOF
test_cmp expect actual
'
git -C clone-all-some cat-file --batch-check <oids &&
git -C clone-all-some for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
+ grep "refs/bundles/heads/" refs >actual &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
+ refs/bundles/heads/base
+ refs/bundles/heads/left
EOF
test_cmp expect actual
'
git -C clone-all-fail cat-file --batch-check <oids &&
git -C clone-all-fail for-each-ref --format="%(refname)" >refs &&
- ! grep "refs/bundles/" refs
+ ! grep "refs/bundles/heads/" refs
'
test_expect_success 'clone bundle list (file, any mode)' '
git -C clone-any-file cat-file --batch-check <oids &&
git -C clone-any-file for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
+ grep "refs/bundles/heads/" refs >actual &&
cat >expect <<-\EOF &&
- refs/bundles/base
+ refs/bundles/heads/base
EOF
test_cmp expect actual
'
git -C clone-any-fail cat-file --batch-check <oids &&
git -C clone-any-fail for-each-ref --format="%(refname)" >refs &&
- ! grep "refs/bundles/" refs
+ ! grep "refs/bundles/heads/" refs
'
test_expect_success 'negotiation: bundle with part of wanted commits' '
git clone --no-local --bundle-uri="clone-from/A.bundle" \
clone-from nego-bundle-part &&
git -C nego-bundle-part for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
- test_write_lines refs/bundles/topic >expect &&
+ grep "refs/bundles/heads/" refs >actual &&
+ test_write_lines refs/bundles/heads/topic >expect &&
test_cmp expect actual &&
- # Ensure that refs/bundles/topic are sent as "have".
+ # Ensure that refs/bundles/heads/topic are sent as "have".
tip=$(git -C clone-from rev-parse A) &&
test_grep "clone> have $tip" trace-packet.txt
'
--bundle-uri="clone-from/B.bundle" \
clone-from nego-bundle-all &&
git -C nego-bundle-all for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
- test_write_lines refs/bundles/topic >expect &&
+ grep "refs/bundles/heads/" refs >actual &&
+ test_write_lines refs/bundles/heads/topic >expect &&
test_cmp expect actual &&
# We already have all needed commits so no "want" needed.
test_grep ! "clone> want " trace-packet.txt
clone-from nego-bundle-list-no-heuristic &&
git -C nego-bundle-list-no-heuristic for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
+ grep "refs/bundles/heads/" refs >actual &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
+ refs/bundles/heads/base
+ refs/bundles/heads/left
EOF
test_cmp expect actual &&
- tip=$(git -C nego-bundle-list-no-heuristic rev-parse refs/bundles/left) &&
+ tip=$(git -C nego-bundle-list-no-heuristic rev-parse refs/bundles/heads/left) &&
test_grep "clone> have $tip" trace-packet.txt
'
clone-from nego-bundle-list-heuristic &&
git -C nego-bundle-list-heuristic for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
+ grep "refs/bundles/heads/" refs >actual &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
+ refs/bundles/heads/base
+ refs/bundles/heads/left
EOF
test_cmp expect actual &&
- tip=$(git -C nego-bundle-list-heuristic rev-parse refs/bundles/left) &&
+ tip=$(git -C nego-bundle-list-heuristic rev-parse refs/bundles/heads/left) &&
test_grep "clone> have $tip" trace-packet.txt
'
clone-from nego-bundle-list-all &&
git -C nego-bundle-list-all for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
+ grep "refs/bundles/heads/" refs >actual &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
+ refs/bundles/heads/base
+ refs/bundles/heads/left
EOF
test_cmp expect actual &&
# We already have all needed commits so no "want" needed.
git clone --bundle-uri="$HTTPD_URL/B.bundle" \
"$HTTPD_URL/smart/fetch.git" clone-http &&
- git -C clone-http rev-parse refs/bundles/topic >actual &&
+ git -C clone-http rev-parse refs/bundles/heads/topic >actual &&
git -C clone-from rev-parse topic >expect &&
test_cmp expect actual &&
test_when_finished "rm -rf clone-http-non-default-hash" &&
GIT_DEFAULT_HASH=sha256 git clone --bundle-uri="$HTTPD_URL/B.bundle" \
"$HTTPD_URL/smart/fetch.git" clone-http-non-default-hash &&
- git -C clone-http-non-default-hash rev-parse refs/bundles/topic >actual &&
+ git -C clone-http-non-default-hash rev-parse refs/bundles/heads/topic >actual &&
git -C clone-from rev-parse topic >expect &&
test_cmp expect actual
'
git -C clone-any-http cat-file --batch-check <oids &&
git -C clone-list-file for-each-ref --format="%(refname)" >refs &&
- grep "refs/bundles/" refs >actual &&
+ grep "refs/bundles/heads/" refs >actual &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/merge
- refs/bundles/right
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/merge
+ refs/bundles/heads/right
EOF
test_cmp expect actual
'
test_cmp expect actual &&
# We now have only one bundle ref.
- git -C clone-token-http for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C clone-token-http for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-\EOF &&
- refs/bundles/base
+ refs/bundles/heads/base
EOF
test_cmp expect refs &&
test_cmp expect actual &&
# We now have all bundle refs.
- git -C clone-token-http for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C clone-token-http for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/merge
- refs/bundles/right
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/merge
+ refs/bundles/heads/right
EOF
test_cmp expect refs
'
test_cmp expect actual &&
# only received base ref from bundle-1
- git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-\EOF &&
- refs/bundles/base
+ refs/bundles/heads/base
EOF
test_cmp expect refs &&
test_cmp expect actual &&
# received left from bundle-2
- git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
+ refs/bundles/heads/base
+ refs/bundles/heads/left
EOF
test_cmp expect refs &&
# received merge ref from bundle-4, but right is missing
# because we did not download bundle-3.
- git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-\EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/merge
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/merge
EOF
test_cmp expect refs &&
test_cmp expect actual &&
# All bundles failed to unbundle
- git -C download-1 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C download-1 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
test_must_be_empty refs &&
# Case 2: middle bundle does not exist, only two bundles can unbundle
test_cmp expect actual &&
# bundle-1 and bundle-3 could unbundle, but bundle-4 could not
- git -C download-2 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C download-2 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-EOF &&
- refs/bundles/base
- refs/bundles/right
+ refs/bundles/heads/base
+ refs/bundles/heads/right
EOF
test_cmp expect refs &&
test_cmp expect actual &&
# fake.bundle did not unbundle, but the others did.
- git -C download-3 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C download-3 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/right
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/right
EOF
test_cmp expect refs
'
test_cmp expect actual &&
# Check which bundles have unbundled by refs
- git -C fetch-1 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C fetch-1 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/lefter
- refs/bundles/merge
- refs/bundles/right
- refs/bundles/righter
- refs/bundles/top
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/lefter
+ refs/bundles/heads/merge
+ refs/bundles/heads/right
+ refs/bundles/heads/righter
+ refs/bundles/heads/top
EOF
test_cmp expect refs &&
test_cmp expect actual &&
# Check which bundles have unbundled by refs
- git -C fetch-2 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C fetch-2 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/merge
- refs/bundles/right
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/merge
+ refs/bundles/heads/right
EOF
test_cmp expect refs &&
test_cmp expect actual &&
# Check which bundles have unbundled by refs
- git -C fetch-3 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ git -C fetch-3 for-each-ref --format="%(refname)" "refs/bundles/heads/*" >refs &&
cat >expect <<-EOF &&
- refs/bundles/base
- refs/bundles/left
- refs/bundles/lefter
- refs/bundles/right
- refs/bundles/righter
+ refs/bundles/heads/base
+ refs/bundles/heads/left
+ refs/bundles/heads/lefter
+ refs/bundles/heads/right
+ refs/bundles/heads/righter
EOF
test_cmp expect refs
'