diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-04-25 16:41:19 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-25 16:41:19 +0900 |
commit | 32dc15dec1cd9e9fada2983094484ae6e4c93647 (patch) | |
tree | 625393be9fb971cf5c803d2ba3997a4741e4cbc7 /unpack-trees.c | |
parent | ac70c5313351630e44b1fe0267fb4850ebcf1f25 (diff) | |
parent | 7fbbcb21b162883615d5542e06fb2eb8685fd496 (diff) | |
download | git-32dc15dec1cd9e9fada2983094484ae6e4c93647.tar.gz |
Merge branch 'jt/batch-fetch-blobs-in-diff'
While running "git diff" in a lazy clone, we can upfront know which
missing blobs we will need, instead of waiting for the on-demand
machinery to discover them one by one. Aim to achieve better
performance by batching the request for these promised blobs.
* jt/batch-fetch-blobs-in-diff:
diff: batch fetching of missing blobs
sha1-file: support OBJECT_INFO_FOR_PREFETCH
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index afa4a5cea8..50189909b8 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -406,20 +406,21 @@ static int check_updates(struct unpack_trees_options *o) * below. */ struct oid_array to_fetch = OID_ARRAY_INIT; - int fetch_if_missing_store = fetch_if_missing; - fetch_if_missing = 0; for (i = 0; i < index->cache_nr; i++) { struct cache_entry *ce = index->cache[i]; - if ((ce->ce_flags & CE_UPDATE) && - !S_ISGITLINK(ce->ce_mode)) { - if (!has_object_file(&ce->oid)) - oid_array_append(&to_fetch, &ce->oid); - } + + if (!(ce->ce_flags & CE_UPDATE) || + S_ISGITLINK(ce->ce_mode)) + continue; + if (!oid_object_info_extended(the_repository, &ce->oid, + NULL, + OBJECT_INFO_FOR_PREFETCH)) + continue; + oid_array_append(&to_fetch, &ce->oid); } if (to_fetch.nr) fetch_objects(repository_format_partial_clone, to_fetch.oid, to_fetch.nr); - fetch_if_missing = fetch_if_missing_store; oid_array_clear(&to_fetch); } for (i = 0; i < index->cache_nr; i++) { |