diff options
| author | Junio C Hamano <gitster@pobox.com> | 2021-09-20 15:20:39 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-09-20 15:20:39 -0700 |
| commit | deec8aa2d05aba0a2ba495f9d41ab4e2805c8b9e (patch) | |
| tree | d263c17f9a7f76297adbec472ade5e3923f0e673 /fetch-pack.c | |
| parent | 4c719308ce59dc70e606f910f40801f2c6051b24 (diff) | |
| parent | caff8b73402d4b5edb2c6c755506c5a90351b69a (diff) | |
| download | git-deec8aa2d05aba0a2ba495f9d41ab4e2805c8b9e.tar.xz | |
Merge branch 'ps/fetch-optim'
Optimize code that handles large number of refs in the "git fetch"
code path.
* ps/fetch-optim:
fetch: avoid second connectivity check if we already have all objects
fetch: merge fetching and consuming refs
fetch: refactor fetch refs to be more extendable
fetch-pack: optimize loading of refs via commit graph
connected: refactor iterator to return next object ID directly
fetch: avoid unpacking headers in object existence check
fetch: speed up lookup of want refs via commit-graph
Diffstat (limited to 'fetch-pack.c')
| -rw-r--r-- | fetch-pack.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fetch-pack.c b/fetch-pack.c index 0bf7ed7e47..a9604f35a3 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -119,6 +119,11 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid, { enum object_type type; struct object_info info = { .typep = &type }; + struct commit *commit; + + commit = lookup_commit_in_graph(the_repository, oid); + if (commit) + return commit; while (1) { if (oid_object_info_extended(the_repository, oid, &info, @@ -1912,16 +1917,15 @@ static void update_shallow(struct fetch_pack_args *args, oid_array_clear(&ref); } -static int iterate_ref_map(void *cb_data, struct object_id *oid) +static const struct object_id *iterate_ref_map(void *cb_data) { struct ref **rm = cb_data; struct ref *ref = *rm; if (!ref) - return -1; /* end of the list */ + return NULL; *rm = ref->next; - oidcpy(oid, &ref->old_oid); - return 0; + return &ref->old_oid; } struct ref *fetch_pack(struct fetch_pack_args *args, |
