diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-17 01:53:07 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-17 01:53:07 +0100 |
commit | 6969ac64bf1c7bc43e897d6bfe7d2450d37e9aa9 (patch) | |
tree | 282ec839d4f21b10780f3942460e2103a77b98ff /refs.c | |
parent | Merge branch 'tk/empty-untracked-cache' (diff) | |
parent | refs/files-backend: optimize reading of symbolic refs (diff) | |
download | git-6969ac64bf1c7bc43e897d6bfe7d2450d37e9aa9.tar.xz git-6969ac64bf1c7bc43e897d6bfe7d2450d37e9aa9.zip |
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
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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, |