diff options
| author | Junio C Hamano <gitster@pobox.com> | 2019-05-13 23:50:31 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2019-05-13 23:50:32 +0900 |
| commit | 5b51f0d38d24a21dc69a53e972497928183d399e (patch) | |
| tree | f6a2e1ec6e7984f0550c1099bc210dc79627f345 /connected.c | |
| parent | Merge branch 'jh/trace2-sid-fix' (diff) | |
| parent | t/perf: add perf script for partial clones (diff) | |
| download | git-5b51f0d38d24a21dc69a53e972497928183d399e.tar.gz git-5b51f0d38d24a21dc69a53e972497928183d399e.zip | |
Merge branch 'js/partial-clone-connectivity-check'
During an initial "git clone --depth=..." partial clone, it is
pointless to spend cycles for a large portion of the connectivity
check that enumerates and skips promisor objects (which by
definition is all objects fetched from the other side). This has
been optimized out.
* js/partial-clone-connectivity-check:
t/perf: add perf script for partial clones
clone: do faster object check for partial clones
Diffstat (limited to 'connected.c')
| -rw-r--r-- | connected.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/connected.c b/connected.c index 1bba888eff..1ab481fed6 100644 --- a/connected.c +++ b/connected.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "object-store.h" #include "run-command.h" #include "sigchain.h" #include "connected.h" @@ -49,6 +50,22 @@ int check_connected(oid_iterate_fn fn, void *cb_data, strbuf_release(&idx_file); } + if (opt->check_refs_only) { + /* + * For partial clones, we don't want to have to do a regular + * connectivity check because we have to enumerate and exclude + * all promisor objects (slow), and then the connectivity check + * itself becomes a no-op because in a partial clone every + * object is a promisor object. Instead, just make sure we + * received the objects pointed to by each wanted ref. + */ + do { + if (!repo_has_object_file(the_repository, &oid)) + return 1; + } while (!fn(cb_data, &oid)); + return 0; + } + if (opt->shallow_file) { argv_array_push(&rev_list.args, "--shallow-file"); argv_array_push(&rev_list.args, opt->shallow_file); |
