<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs/debug.c, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-03-17T17:40:14Z</updated>
<entry>
<title>refs debug: add a wrapper for "read_symbolic_ref"</title>
<updated>2022-03-17T17:40:14Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-17T17:27:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5b8754043c9cbe47f3de35f2d196f074645d135f'/>
<id>urn:sha1:5b8754043c9cbe47f3de35f2d196f074645d135f</id>
<content type='text'>
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 &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: use designated initializers for "struct ref_iterator_vtable"</title>
<updated>2022-03-17T17:36:11Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-17T17:27:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e2f8acb6a0399c7480574d23c48c437e4849399a'/>
<id>urn:sha1:e2f8acb6a0399c7480574d23c48c437e4849399a</id>
<content type='text'>
Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: use designated initializers for "struct ref_storage_be"</title>
<updated>2022-03-17T17:36:04Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-17T17:27:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=32bff617c6aff52d6d147c8b4e93efc7f06fa388'/>
<id>urn:sha1:32bff617c6aff52d6d147c8b4e93efc7f06fa388</id>
<content type='text'>
Change the definition of the three refs backends we currently carry to
use designated initializers.

The "= NULL" assignments being retained here are redundant, and could
be removed, but let's keep them for clarity. All of these backends
define almost all fields, so we're not saving much in terms of line
count by omitting these, but e.g. for "refs_be_debug" it's immediately
apparent that we're omitting "init" when comparing its assignment to
the others.

This is a follow-up to similar work merged in bd4232fac33 (Merge
branch 'ab/struct-init', 2021-07-16), a4b9fb6a5cf (Merge branch
'ab/designated-initializers-more', 2021-10-18) and a30321b9eae (Merge
branch 'ab/designated-initializers' into
ab/designated-initializers-more, 2021-09-27).

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: add ability for backends to special-case reading of symbolic refs</title>
<updated>2022-03-01T18:13:46Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2022-03-01T09:33:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cd475b3b03809b1b1c664e0dca9f16f815456719'/>
<id>urn:sha1:cd475b3b03809b1b1c664e0dca9f16f815456719</id>
<content type='text'>
Reading of symbolic and non-symbolic references is currently treated the
same in reference backends: we always call `refs_read_raw_ref()` and
then decide based on the returned flags what type it is. This has one
downside though: symbolic references may be treated different from
normal references in a backend from normal references. The packed-refs
backend for example doesn't even know about symbolic references, and as
a result it is pointless to even ask it for one.

There are cases where we really only care about whether a reference is
symbolic or not, but don't care about whether it exists at all or may be
a non-symbolic reference. But it is not possible to optimize for this
case right now, and as a consequence we will always first check for a
loose reference to exist, and if it doesn't, we'll query the packed-refs
backend for a known-to-not-be-symbolic reference. This is inefficient
and requires us to search all packed references even though we know to
not care for the result at all.

Introduce a new function `refs_read_symbolic_ref()` which allows us to
fix this case. This function will only ever return symbolic references
and can thus optimize for the scenario layed out above. By default, if
the backend doesn't provide an implementation for it, we just use the
old code path and fall back to `read_raw_ref()`. But in case the backend
provides its own, more efficient implementation, we will use that one
instead.

Note that this function is explicitly designed to not distinguish
between missing references and non-symbolic references. If it did, we'd
be forced to always search the packed-refs backend to see whether the
symbolic reference the user asked for really doesn't exist, or if it
exists as a non-symbolic reference.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: centralize initialization of the base ref_store.</title>
<updated>2021-12-22T21:51:38Z</updated>
<author>
<name>Han-Wen Nienhuys</name>
<email>hanwen@google.com</email>
</author>
<published>2021-12-22T18:11:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f9f7fd3b238cc56224c30235a0d248d027b7ecfa'/>
<id>urn:sha1:f9f7fd3b238cc56224c30235a0d248d027b7ecfa</id>
<content type='text'>
Signed-off-by: Han-Wen Nienhuys &lt;hanwen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: print error message in debug output</title>
<updated>2021-12-22T21:51:37Z</updated>
<author>
<name>Han-Wen Nienhuys</name>
<email>hanwen@google.com</email>
</author>
<published>2021-12-22T18:11:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a6db572af6bc792590716856d80e8b9c02a55bec'/>
<id>urn:sha1:a6db572af6bc792590716856d80e8b9c02a55bec</id>
<content type='text'>
Signed-off-by: Han-Wen Nienhuys &lt;hanwen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'hn/reflog-tests'</title>
<updated>2021-12-15T17:39:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-15T17:39:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=250ca49b4f3ee0781a98c47f4515ae597ca3dbab'/>
<id>urn:sha1:250ca49b4f3ee0781a98c47f4515ae597ca3dbab</id>
<content type='text'>
Prepare tests on ref API to help testing reftable backends.

* hn/reflog-tests:
  refs/debug: trim trailing LF from reflog message
  test-ref-store: tweaks to for-each-reflog-ent format
  t1405: check for_each_reflog_ent_reverse() more thoroughly
  test-ref-store: don't add newline to reflog message
  show-branch: show reflog message
</content>
</entry>
<entry>
<title>refs/debug: trim trailing LF from reflog message</title>
<updated>2021-12-02T19:14:08Z</updated>
<author>
<name>Han-Wen Nienhuys</name>
<email>hanwen@google.com</email>
</author>
<published>2021-12-02T17:36:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=65279256f3d3576ff16332d7f0ee124f593cb476'/>
<id>urn:sha1:65279256f3d3576ff16332d7f0ee124f593cb476</id>
<content type='text'>
On iteration, the reflog message is always terminated by a newline. Trim it to
avoid clobbering the console with is this extra newline.

Signed-off-by: Han-Wen Nienhuys &lt;hanwen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: drop force_create argument of create_reflog API</title>
<updated>2021-11-22T19:01:25Z</updated>
<author>
<name>Han-Wen Nienhuys</name>
<email>hanwen@google.com</email>
</author>
<published>2021-11-22T14:19:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b089120d9e0065978da461f8ccf42000e6760a4'/>
<id>urn:sha1:7b089120d9e0065978da461f8ccf42000e6760a4</id>
<content type='text'>
There is only one caller, builtin/checkout.c, and it hardcodes
force_create=1.

This argument was introduced in abd0cd3a301 (refs: new public ref function:
safe_create_reflog, 2015-07-21), which promised to immediately use it in a
follow-on commit, but that never happened.

Signed-off-by: Han-Wen Nienhuys &lt;hanwen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'hn/refs-errno-cleanup'</title>
<updated>2021-10-04T04:49:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-10-04T04:49:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=92382d14cd4146ad05e891a529ed3ce5822d11f7'/>
<id>urn:sha1:92382d14cd4146ad05e891a529ed3ce5822d11f7</id>
<content type='text'>
Futz with the way 'errno' is relied on in the refs API to carry the
failure modes up the call chain.

* hn/refs-errno-cleanup:
  refs: make errno output explicit for read_raw_ref_fn
  refs/files-backend: stop setting errno from lock_ref_oid_basic
  refs: remove EINVAL errno output from specification of read_raw_ref_fn
  refs file backend: move raceproof_create_file() here
</content>
</entry>
</feed>
