<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.c, branch v2.36.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.36.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.36.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-04-13T22:51:33Z</updated>
<entry>
<title>Revert "Merge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'"</title>
<updated>2022-04-13T22:51:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-04-13T22:51:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c6da34a610e58f7e58042b5ed24a19bd2c18e928'/>
<id>urn:sha1:c6da34a610e58f7e58042b5ed24a19bd2c18e928</id>
<content type='text'>
This reverts commit 991b4d47f0accd3955d05927d5ce434e03ffbdb6, reversing
changes made to bcd020f88e1e22f38422ac3f73ab06b34ec4bef1.
</content>
</entry>
<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>Merge branch 'ps/fetch-mirror-optim'</title>
<updated>2022-03-17T00:53:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-17T00:53:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6969ac64bf1c7bc43e897d6bfe7d2450d37e9aa9'/>
<id>urn:sha1:6969ac64bf1c7bc43e897d6bfe7d2450d37e9aa9</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>Merge branch 'ps/fetch-atomic'</title>
<updated>2022-03-13T22:56:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-13T22:56:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=851d2f0ab123c8fa33bbdc8e5a325e0c8b2c5d9c'/>
<id>urn:sha1:851d2f0ab123c8fa33bbdc8e5a325e0c8b2c5d9c</id>
<content type='text'>
"git fetch" can make two separate fetches, but ref updates coming
from them were in two separate ref transactions under "--atomic",
which has been corrected.

* ps/fetch-atomic:
  fetch: make `--atomic` flag cover pruning of refs
  fetch: make `--atomic` flag cover backfilling of tags
  refs: add interface to iterate over queued transactional updates
  fetch: report errors when backfilling tags fails
  fetch: control lifecycle of FETCH_HEAD in a single place
  fetch: backfill tags before setting upstream
  fetch: increase test coverage of fetches
</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>Merge branch 'ps/fetch-atomic' into ps/fetch-mirror-optim</title>
<updated>2022-03-01T18:11:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-01T18:11:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=34363403a28ad4d0bd76c5aa7351293b6e4a4e47'/>
<id>urn:sha1:34363403a28ad4d0bd76c5aa7351293b6e4a4e47</id>
<content type='text'>
* ps/fetch-atomic:
  fetch: make `--atomic` flag cover pruning of refs
  fetch: make `--atomic` flag cover backfilling of tags
  refs: add interface to iterate over queued transactional updates
  fetch: report errors when backfilling tags fails
  fetch: control lifecycle of FETCH_HEAD in a single place
  fetch: backfill tags before setting upstream
  fetch: increase test coverage of fetches
</content>
</entry>
<entry>
<title>Merge branch 'ab/date-mode-release'</title>
<updated>2022-02-25T23:47:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-25T23:47:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0a01df08c03fe707e22795de7bd1d763ed02e9e1'/>
<id>urn:sha1:0a01df08c03fe707e22795de7bd1d763ed02e9e1</id>
<content type='text'>
Plug (some) memory leaks around parse_date_format().

* ab/date-mode-release:
  date API: add and use a date_mode_release()
  date API: add basic API docs
  date API: provide and use a DATE_MODE_INIT
  date API: create a date.h, split from cache.h
  cache.h: remove always unused show_date_human() declaration
</content>
</entry>
<entry>
<title>Merge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'</title>
<updated>2022-02-18T21:53:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-18T21:53:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=991b4d47f0accd3955d05927d5ce434e03ffbdb6'/>
<id>urn:sha1:991b4d47f0accd3955d05927d5ce434e03ffbdb6</id>
<content type='text'>
Because a deletion of ref would need to remove it from both the
loose ref store and the packed ref store, a delete-ref operation
that logically removes one ref may end up invoking ref-transaction
hook twice, which has been corrected.

* ps/avoid-unnecessary-hook-invocation-with-packed-refs:
  refs: skip hooks when deleting uncovered packed refs
  refs: do not execute reference-transaction hook on packing refs
  refs: demonstrate excessive execution of the reference-transaction hook
  refs: allow skipping the reference-transaction hook
  refs: allow passing flags when beginning transactions
  refs: extract packed_refs_delete_refs() to allow control of transaction
</content>
</entry>
<entry>
<title>refs: add interface to iterate over queued transactional updates</title>
<updated>2022-02-17T19:19:44Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2022-02-17T13:04:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4f2ba2d06a7dd7e84e105a2779a7f07549d04231'/>
<id>urn:sha1:4f2ba2d06a7dd7e84e105a2779a7f07549d04231</id>
<content type='text'>
There is no way for a caller to see whether a reference update has
already been queued up for a given reference transaction. There are
multiple alternatives to provide this functionality:

    - We may add a function that simply tells us whether a specific
      reference has already been queued. If implemented naively then
      this would potentially be quadratic in runtime behaviour if this
      question is asked repeatedly because we have to iterate over all
      references every time. The alternative would be to add a hashmap
      of all queued reference updates to speed up the lookup, but this
      adds overhead to all callers.

    - We may add a flag to `ref_transaction_add_update()` that causes it
      to skip duplicates, but this has the same runtime concerns as the
      first alternative.

    - We may add an interface which lets callers collect all updates
      which have already been queued such that he can avoid re-adding
      them. This is the most flexible approach and puts the burden on
      the caller, but also allows us to not impact any of the existing
      callsites which don't need this information.

This commit implements the last approach: it allows us to compute the
map of already-queued updates once up front such that we can then skip
all subsequent references which are already part of this map.

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>date API: create a date.h, split from cache.h</title>
<updated>2022-02-16T17:40:00Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-02-16T08:14:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=88c7b4c3c8d51510d20ebb9990750ad0e97afbfb'/>
<id>urn:sha1:88c7b4c3c8d51510d20ebb9990750ad0e97afbfb</id>
<content type='text'>
Move the declaration of the date.c functions from cache.h, and adjust
the relevant users to include the new date.h header.

The show_ident_date() function belonged in pretty.h (it's defined in
pretty.c), its two users outside of pretty.c didn't strictly need to
include pretty.h, as they get it indirectly, but let's add it to them
anyway.

Similarly, the change to "builtin/{fast-import,show-branch,tag}.c"
isn't needed as far as the compiler is concerned, but since they all
use the "DATE_MODE()" macro we now define in date.h, let's have them
include it.

We could simply include this new header in "cache.h", but as this
change shows these functions weren't common enough to warrant
including in it in the first place. By moving them out of cache.h
changes to this API will no longer cause a (mostly) full re-build of
the project when "make" is run.

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>
</feed>
