Merge branch 'xx/bundie-uri-fixes'

When bundleURI interface fetches multiple bundles, Git failed to
take full advantage of all bundles and ended up slurping duplicated
objects.

* xx/bundie-uri-fixes:
  unbundle: extend object verification for fetches
  fetch-pack: expose fsckObjects configuration logic
  bundle-uri: verify oid before writing refs
This commit is contained in:
Junio C Hamano
2024-07-08 14:53:11 -07:00
8 changed files with 243 additions and 14 deletions

View File

@ -139,6 +139,41 @@ test_expect_success 'fetch SHA-1 from bundle' '
git fetch --no-tags foo/tip.bundle "$(cat hash)"
'
test_expect_success 'clone bundle with different fsckObjects configurations' '
test_create_repo bundle-fsck &&
(
cd bundle-fsck &&
test_commit A &&
commit_a=$(git rev-parse A) &&
tree_a=$(git rev-parse A^{tree}) &&
cat >data <<-EOF &&
tree $tree_a
parent $commit_a
author A U Thor
committer A U Thor
commit: this is a commit with bad emails
EOF
bad_commit=$(git hash-object --literally -t commit -w --stdin <data) &&
git branch bad $bad_commit &&
git bundle create bad.bundle bad
) &&
git clone bundle-fsck/bad.bundle bundle-no-fsck &&
git -c fetch.fsckObjects=false -c transfer.fsckObjects=true \
clone bundle-fsck/bad.bundle bundle-fetch-no-fsck &&
test_must_fail git -c fetch.fsckObjects=true \
clone bundle-fsck/bad.bundle bundle-fetch-fsck 2>err &&
test_grep "missingEmail" err &&
test_must_fail git -c transfer.fsckObjects=true \
clone bundle-fsck/bad.bundle bundle-transfer-fsck 2>err &&
test_grep "missingEmail" err
'
test_expect_success 'git bundle uses expected default format' '
git bundle create bundle HEAD^.. &&
cat >expect <<-EOF &&