diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-08-02 21:06:42 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-02 21:06:42 (GMT) |
commit | 8230107f336b29d25111c517639b8cd5717c8416 (patch) | |
tree | b24d756b13a4877290c6369d9833d8e6e8f28120 /unpack-trees.c | |
parent | e9fe413fc29efac6d223cf1bd0cad10231e37df3 (diff) | |
parent | d3da223f2214ebc1527ccf66428aa975de916682 (diff) | |
download | git-8230107f336b29d25111c517639b8cd5717c8416.zip git-8230107f336b29d25111c517639b8cd5717c8416.tar.gz git-8230107f336b29d25111c517639b8cd5717c8416.tar.bz2 |
Merge branch 'jt/bulk-prefetch'
"git read-tree" had a codepath where blobs are fetched one-by-one
from the promisor remote, which has been corrected to fetch in bulk.
* jt/bulk-prefetch:
cache-tree: prefetch in partial clone read-tree
unpack-trees: refactor prefetching code
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index 0a5135a..afc39db 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -392,6 +392,11 @@ static void report_collided_checkout(struct index_state *index) string_list_clear(&list, 0); } +static int must_checkout(const struct cache_entry *ce) +{ + return ce->ce_flags & CE_UPDATE; +} + static int check_updates(struct unpack_trees_options *o, struct index_state *index) { @@ -442,28 +447,12 @@ static int check_updates(struct unpack_trees_options *o, if (should_update_submodules()) load_gitmodules_file(index, &state); - if (has_promisor_remote()) { + if (has_promisor_remote()) /* * Prefetch the objects that are to be checked out in the loop * below. */ - struct oid_array to_fetch = OID_ARRAY_INIT; - 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)) - continue; - if (!oid_object_info_extended(the_repository, &ce->oid, - NULL, - OBJECT_INFO_FOR_PREFETCH)) - continue; - oid_array_append(&to_fetch, &ce->oid); - } - promisor_remote_get_direct(the_repository, - to_fetch.oid, to_fetch.nr); - oid_array_clear(&to_fetch); - } + prefetch_cache_entries(index, must_checkout); get_parallel_checkout_configs(&pc_workers, &pc_threshold); @@ -473,7 +462,7 @@ static int check_updates(struct unpack_trees_options *o, for (i = 0; i < index->cache_nr; i++) { struct cache_entry *ce = index->cache[i]; - if (ce->ce_flags & CE_UPDATE) { + if (must_checkout(ce)) { size_t last_pc_queue_size = pc_queue_size(); if (ce->ce_flags & CE_WT_REMOVE) |