diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-03-17 18:27:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-17 10:40:14 -0700 |
commit | 5b8754043c9cbe47f3de35f2d196f074645d135f (patch) | |
tree | 0b2f31d1a1508149f92d8aa306c0a0a5404303ef /refs.c | |
parent | ca40893a41e2cc742316232f3d044df99a4cdac2 (diff) | |
download | git-5b8754043c9cbe47f3de35f2d196f074645d135f.tar.gz |
refs debug: add a wrapper for "read_symbolic_ref"
In cd475b3b038 (refs: add ability for backends to special-case reading
of symbolic refs, 2022-03-01) when the "read_symbolic_ref" callback
was added we'd fall back on "refs_read_raw_ref" if there wasn't any
backend implementation of "read_symbolic_ref".
As discussed in the preceding commit this would only happen if we were
running the "debug" backend, e.g. in the "setup for ref completion"
test in t9902-completion.sh with:
GIT_TRACE_REFS=1 git fetch --no-tags other
Let's improve the trace output, but and also eliminate the
now-redundant refs_read_raw_ref() fallback case. As noted in the
preceding commit the "packed" backend will never call
refs_read_symbolic_ref() (nor is it ever going to). For any future
backend such as reftable it's OK to ask that they either implement
this (or a wrapper) themselves.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 13 |
1 files changed, 1 insertions, 12 deletions
@@ -1676,18 +1676,7 @@ int refs_read_raw_ref(struct ref_store *ref_store, const char *refname, 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; + return ref_store->be->read_symbolic_ref(ref_store, refname, referent); } const char *refs_resolve_ref_unsafe(struct ref_store *refs, |