Merge branch 'ps/fetch-mirror-optim'

Various optimization for "git fetch".

* ps/fetch-mirror-optim:
  refs/files-backend: optimize reading of symbolic refs
  remote: read symbolic refs via `refs_read_symbolic_ref()`
  refs: add ability for backends to special-case reading of symbolic refs
  fetch: avoid lookup of commits when not appending to FETCH_HEAD
  upload-pack: look up "want" lines via commit-graph
This commit is contained in:
Junio C Hamano
2022-03-16 17:53:07 -07:00
10 changed files with 122 additions and 33 deletions

17
refs.c
View File

@ -1673,6 +1673,23 @@ int refs_read_raw_ref(struct ref_store *ref_store, const char *refname,
type, failure_errno);
}
int refs_read_symbolic_ref(struct ref_store *ref_store, const char *refname,
struct strbuf *referent)
{
struct object_id oid;
int ret, failure_errno = 0;
unsigned int type = 0;
if (ref_store->be->read_symbolic_ref)
return ref_store->be->read_symbolic_ref(ref_store, refname, referent);
ret = refs_read_raw_ref(ref_store, refname, &oid, referent, &type, &failure_errno);
if (ret || !(type & REF_ISSYMREF))
return -1;
return 0;
}
const char *refs_resolve_ref_unsafe(struct ref_store *refs,
const char *refname,
int resolve_flags,