summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-09-20 15:20:39 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-20 15:20:39 -0700
commitdeec8aa2d05aba0a2ba495f9d41ab4e2805c8b9e (patch)
treed263c17f9a7f76297adbec472ade5e3923f0e673 /builtin/clone.c
parentThe sixth batch (diff)
parentfetch: avoid second connectivity check if we already have all objects (diff)
downloadtgif-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 'builtin/clone.c')
-rw-r--r--builtin/clone.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index b93bcd460e..143b4e0a3e 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -657,7 +657,7 @@ static void write_followtags(const struct ref *refs, const char *msg)
}
}
-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;
@@ -668,13 +668,11 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid)
*/
while (ref && !ref->peer_ref)
ref = ref->next;
- /* Returning -1 notes "end of list" to the caller. */
if (!ref)
- return -1;
+ return NULL;
- oidcpy(oid, &ref->old_oid);
*rm = ref->next;
- return 0;
+ return &ref->old_oid;
}
static void update_remote_refs(const struct ref *refs,