diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-02-13 13:39:04 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-13 13:39:04 -0800 |
commit | 6bed209a20a06f2d6b7142216dabff456de798e1 (patch) | |
tree | ee1b6980108adb6cd4cb03c5749256434f01a809 /unpack-trees.c | |
parent | f3d618d2bf4099abe99babc8b56dcd483c5eec71 (diff) | |
parent | 3aa6694fb3d38a3afe623ccbdf59fb15f338a94d (diff) | |
download | git-6bed209a20a06f2d6b7142216dabff456de798e1.tar.gz |
Merge branch 'jh/partial-clone'
The machinery to clone & fetch, which in turn involves packing and
unpacking objects, have been told how to omit certain objects using
the filtering mechanism introduced by the jh/object-filtering
topic, and also mark the resulting pack as a promisor pack to
tolerate missing objects, taking advantage of the mechanism
introduced by the jh/fsck-promisors topic.
* jh/partial-clone:
t5616: test bulk prefetch after partial fetch
fetch: inherit filter-spec from partial clone
t5616: end-to-end tests for partial clone
fetch-pack: restore save_commit_buffer after use
unpack-trees: batch fetching of missing blobs
clone: partial clone
partial-clone: define partial clone settings in config
fetch: support filters
fetch: refactor calculation of remote list
fetch-pack: test support excluding large blobs
fetch-pack: add --no-filter
fetch-pack, index-pack, transport: partial clone
upload-pack: add object filtering for partial clone
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index 96c3327f19..e6a15bbe44 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -15,6 +15,7 @@ #include "submodule.h" #include "submodule-config.h" #include "fsmonitor.h" +#include "fetch-object.h" /* * Error messages expected by scripts out of plumbing commands such as @@ -370,6 +371,27 @@ static int check_updates(struct unpack_trees_options *o) load_gitmodules_file(index, &state); enable_delayed_checkout(&state); + if (repository_format_partial_clone && o->update && !o->dry_run) { + /* + * Prefetch the objects that are to be checked out in the loop + * 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 (to_fetch.nr) + fetch_objects(repository_format_partial_clone, + &to_fetch); + fetch_if_missing = fetch_if_missing_store; + } for (i = 0; i < index->cache_nr; i++) { struct cache_entry *ce = index->cache[i]; |