]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jt/non-blob-lazy-fetch'
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Oct 2018 04:34:07 +0000 (13:34 +0900)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Oct 2018 04:34:07 +0000 (13:34 +0900)
A partial clone that is configured to lazily fetch missing objects
will on-demand issue a "git fetch" request to the originating
repository to fill not-yet-obtained objects.  The request has been
optimized for requesting a tree object (and not the leaf blob
objects contained in it) by telling the originating repository that
no blobs are needed.

* jt/non-blob-lazy-fetch:
  fetch-pack: exclude blobs when lazy-fetching trees
  fetch-pack: avoid object flags if no_dependents

1  2 
fetch-pack.c
t/t0410-partial-clone.sh

diff --cc fetch-pack.c
Simple merge
index cfd0655ea19b0caa8d55fd41b5b76abde4de1c8b,08a0c3651c7977d3c9abd1ab883ec00cb0af9dc3..c521d7d6c61f3e3c76d5c4d51440ae114004a362
@@@ -170,18 -170,47 +170,59 @@@ test_expect_success 'fetching of missin
        git verify-pack --verbose "$IDX" | grep "$HASH"
  '
  
 +test_expect_success 'fetching of missing objects works with ref-in-want enabled' '
 +      # ref-in-want requires protocol version 2
 +      git -C server config protocol.version 2 &&
 +      git -C server config uploadpack.allowrefinwant 1 &&
 +      git -C repo config protocol.version 2 &&
 +
 +      rm -rf repo/.git/objects/* &&
 +      rm -f trace &&
 +      GIT_TRACE_PACKET="$(pwd)/trace" git -C repo cat-file -p "$HASH" &&
 +      grep "git< fetch=.*ref-in-want" trace
 +'
 +
+ test_expect_success 'fetching of missing blobs works' '
+       rm -rf server repo &&
+       test_create_repo server &&
+       test_commit -C server foo &&
+       git -C server repack -a -d --write-bitmap-index &&
+       git clone "file://$(pwd)/server" repo &&
+       git hash-object repo/foo.t >blobhash &&
+       rm -rf repo/.git/objects/* &&
+       git -C server config uploadpack.allowanysha1inwant 1 &&
+       git -C server config uploadpack.allowfilter 1 &&
+       git -C repo config core.repositoryformatversion 1 &&
+       git -C repo config extensions.partialclone "origin" &&
+       git -C repo cat-file -p $(cat blobhash)
+ '
+ test_expect_success 'fetching of missing trees does not fetch blobs' '
+       rm -rf server repo &&
+       test_create_repo server &&
+       test_commit -C server foo &&
+       git -C server repack -a -d --write-bitmap-index &&
+       git clone "file://$(pwd)/server" repo &&
+       git -C repo rev-parse foo^{tree} >treehash &&
+       git hash-object repo/foo.t >blobhash &&
+       rm -rf repo/.git/objects/* &&
+       git -C server config uploadpack.allowanysha1inwant 1 &&
+       git -C server config uploadpack.allowfilter 1 &&
+       git -C repo config core.repositoryformatversion 1 &&
+       git -C repo config extensions.partialclone "origin" &&
+       git -C repo cat-file -p $(cat treehash) &&
+       # Ensure that the tree, but not the blob, is fetched
+       git -C repo rev-list --objects --missing=print $(cat treehash) >objects &&
+       grep "^$(cat treehash)" objects &&
+       grep "^[?]$(cat blobhash)" objects
+ '
  test_expect_success 'rev-list stops traversal at missing and promised commit' '
        rm -rf repo &&
        test_create_repo repo &&