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
This commit is contained in:
Junio C Hamano
2021-09-20 15:20:39 -07:00
6 changed files with 67 additions and 61 deletions

View File

@ -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,