<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/shallow.c, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-04-01T03:43:14Z</updated>
<entry>
<title>odb: rename `odb_has_object()` flags</title>
<updated>2026-04-01T03:43:14Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-31T23:57:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c63911b052dc286de5daddba8d4a20fd59348cee'/>
<id>urn:sha1:c63911b052dc286de5daddba8d4a20fd59348cee</id>
<content type='text'>
Rename `odb_has_object()` flags to be properly prefixed with the
function name.

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 'sp/shallow-deepen-relative-fix'</title>
<updated>2026-03-04T18:52:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-04T18:52:59Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=fa383b96c7211a415152dffaf6b272bb09116f06'/>
<id>urn:sha1:fa383b96c7211a415152dffaf6b272bb09116f06</id>
<content type='text'>
"git fetch --deepen" that tries to go beyond merged branch used to
get confused where the updated shallow points are, which has been
corrected.

* sp/shallow-deepen-relative-fix:
  shallow: handling fetch relative-deepen
  shallow: free local object_array allocations
</content>
</entry>
<entry>
<title>shallow: handling fetch relative-deepen</title>
<updated>2026-02-17T19:46:15Z</updated>
<author>
<name>Samo Pogačnik</name>
<email>samo_pogacnik@t-2.net</email>
</author>
<published>2026-02-15T20:11:56Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3ef68ff40ebf75bba9c4b05f50197190ff1abda2'/>
<id>urn:sha1:3ef68ff40ebf75bba9c4b05f50197190ff1abda2</id>
<content type='text'>
When a shallowed repository gets deepened beyond the beginning of a
merged branch, we may end up with some shallows that are hidden behind
the reachable shallow commits. Added test 'fetching deepen beyond
merged branch' exposes that behaviour.

An example showing the problem based on added test:
0. Whole initial git repo to be cloned from
   Graph:
   *   033585d (HEAD -&gt; main) Merge branch 'branch'
   |\
   | * 984f8b1 (branch) five
   | * ecb578a four
   |/
   * 0cb5d20 three
   * 2b4e70d two
   * 61ba98b one

1. Initial shallow clone --depth=3 (all good)
   Shallows:
   2b4e70da2a10e1d3231a0ae2df396024735601f1
   ecb578a3cf37198d122ae5df7efed9abaca17144
   Graph:
   *   033585d (HEAD -&gt; main) Merge branch 'branch'
   |\
   | * 984f8b1 five
   | * ecb578a (grafted) four
   * 0cb5d20 three
   * 2b4e70d (grafted) two

2. Deepen shallow clone with fetch --deepen=1 (NOT OK)
   Shallows:
   0cb5d204f4ef96ed241feb0f2088c9f4794ba758
   61ba98be443fd51c542eb66585a1f6d7e15fcdae
   Graph:
   *   033585d (HEAD -&gt; main) Merge branch 'branch'
   |\
   | * 984f8b1 five
   | * ecb578a four
   |/
   * 0cb5d20 (grafted) three
   ---
   Note that second shallow commit 61ba98be443fd51c542eb66585a1f6d7e15fcdae
   is not reachable.

On the other hand, it seems that equivalent absolute depth driven
fetches result in all the correct shallows. That led to this proposal,
which unifies absolute and relative deepening in a way that the same
get_shallow_commits() call is used in both cases. The difference is
only that depth is adapted for relative deepening by measuring
equivalent depth of current local shallow commits in the current remote
repo. Thus a new function get_shallows_depth() has been added and the
function get_reachable_list() became redundant / removed.

Same example showing the corrected second step:
2. Deepen shallow clone with fetch --deepen=1 (all good)
   Shallow:
   61ba98be443fd51c542eb66585a1f6d7e15fcdae
   Graph:
   *   033585d (HEAD -&gt; main) Merge branch 'branch'
   |\
   | * 984f8b1 five
   | * ecb578a four
   |/
   * 0cb5d20 three
   * 2b4e70d two
   * 61ba98b (grafted) one

The get_shallows_depth() function also shares the logic of the
get_shallow_commits() function, but it focuses on counting depth of
each existing shallow commit. The minimum result is stored as
'data-&gt;deepen_relative', which is set not to be zero for relative
deepening anyway. That way we can always sum 'data-&gt;deepen_relative'
and 'depth' values, because 'data-&gt;deepen_relative' is always 0 in
absolute deepening.
To avoid duplicating logic between get_shallows_depth() and
get_shallow_commits(), get_shallow_commits() was modified so that
it is used by get_shallows_depth().

Signed-off-by: Samo Pogačnik &lt;samo_pogacnik@t-2.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>shallow: free local object_array allocations</title>
<updated>2026-02-17T19:16:10Z</updated>
<author>
<name>Samo Pogačnik</name>
<email>samo_pogacnik@t-2.net</email>
</author>
<published>2026-02-15T20:11:55Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d0abfb048fe0a069a4d3cd42fdd0c99afec141c4'/>
<id>urn:sha1:d0abfb048fe0a069a4d3cd42fdd0c99afec141c4</id>
<content type='text'>
The local object_array 'stack' in get_shallow_commits() function
does not free its dynamic elements before the function returns.
As a result elements remain allocated and their reference forgotten.

Also note, that test 'fetching deepen beyond merged branch' added by
'shallow: handling fetch relative-deepen' patch fails without this
correction in linux-leaks and linux-reftable-leaks test runs.

Signed-off-by: Samo Pogačnik &lt;samo_pogacnik@t-2.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit: rename `free_commit_list()` to conform to coding guidelines</title>
<updated>2026-01-15T13:32:31Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-01-15T09:35:34Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=9f18d089c51fba2776fe1fece877a359c47417f7'/>
<id>urn:sha1:9f18d089c51fba2776fe1fece877a359c47417f7</id>
<content type='text'>
Our coding guidelines say that:

  Functions that operate on `struct S` are named `S_&lt;verb&gt;()` and should
  generally receive a pointer to `struct S` as first parameter.

While most of the functions related to `struct commit_list` already
follow that naming schema, `free_commit_list()` doesn't.

Rename the function to address this and adjust all of its callers. Add a
compatibility wrapper for the old function name to ease the transition
and avoid any semantic conflicts with in-flight patch series. This
wrapper will be removed once Git 2.53 has been released.

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>shallow: use commit_stack</title>
<updated>2025-12-24T23:29:28Z</updated>
<author>
<name>Rene Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-12-24T17:03:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=506a7b66908eb5c3898a3eadbd402308f5b43cf8'/>
<id>urn:sha1:506a7b66908eb5c3898a3eadbd402308f5b43cf8</id>
<content type='text'>
Replace a commit array implementation with commit_stack.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/memzero-array'</title>
<updated>2025-12-23T02:33:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-12-23T02:33:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=86ebd83e6a78671624cf118e3a04d3afcfbe5df4'/>
<id>urn:sha1:86ebd83e6a78671624cf118e3a04d3afcfbe5df4</id>
<content type='text'>
Further application of MEMZERO_ARRAY() macro to the rest of the
code base.

* jc/memzero-array:
  cocci: use MEMZERO_ARRAY() a bit more
  coccicheck: emit the contents of cocci patch
</content>
</entry>
<entry>
<title>cocci: use MEMZERO_ARRAY() a bit more</title>
<updated>2025-12-13T01:47:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-12-13T01:46:28Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=8ea9492cf3505c379d1c573b02db90e6b480cc75'/>
<id>urn:sha1:8ea9492cf3505c379d1c573b02db90e6b480cc75</id>
<content type='text'>
Existing code in files that have been fairly stable trigger the
"make coccicheck" suggestions due to the new check.

Rewrite them to use MEMZERO_ARRAY()

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: introduce wrapper struct for `each_ref_fn`</title>
<updated>2025-11-04T15:32:24Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-10-23T07:16:10Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=bdbebe5714b25dc9d215b48efbb80f410925d7dd'/>
<id>urn:sha1:bdbebe5714b25dc9d215b48efbb80f410925d7dd</id>
<content type='text'>
The `each_ref_fn` callback function type is used across our code base
for several different functions that iterate through reference. There's
a bunch of callbacks implementing this type, which makes any changes to
the callback signature extremely noisy. An example of the required churn
is e8207717f1 (refs: add referent to each_ref_fn, 2024-08-09): adding a
single argument required us to change 48 files.

It was already proposed back then [1] that we might want to introduce a
wrapper structure to alleviate the pain going forward. While this of
course requires the same kind of global refactoring as just introducing
a new parameter, it at least allows us to more change the callback type
afterwards by just extending the wrapper structure.

One counterargument to this refactoring is that it makes the structure
more opaque. While it is obvious which callsites need to be fixed up
when we change the function type, it's not obvious anymore once we use
a structure. That being said, we only have a handful of sites that
actually need to populate this wrapper structure: our ref backends,
"refs/iterator.c" as well as very few sites that invoke the iterator
callback functions directly.

Introduce this wrapper structure so that we can adapt the iterator
interfaces more readily.

[1]: &lt;ZmarVcF5JjsZx0dl@tanuki&gt;

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>treewide: pass strvecs around for setup_revisions_from_strvec()</title>
<updated>2025-09-22T21:27:03Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-09-19T22:50:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=18068139f2d0fc2aa82f34f2c177d781e228e732'/>
<id>urn:sha1:18068139f2d0fc2aa82f34f2c177d781e228e732</id>
<content type='text'>
The previous commit converted callers of setup_revisions() with a strvec
to use the safer and easier _from_strvec() variant.

Let's now convert spots that don't directly have a strvec, but receive
an argc/argv pair that eventually comes from one. We'll instead pass the
strvec down to the point where we call setup_revisions().

That makes these functions slightly less flexible if they were to grow
other callers that don't use strvecs, but this rigidity is buying us
some safety. It is only safe to pass the free_removed_argv_elements
option to setup_revisions() if we know the elements of argv/argc are
allocated on the heap. That isn't communicated in the type system when
we are passed the bare elements. But if we get a strvec, we know that
the elements are allocated strings.

And at any rate, each of these modified functions has only a single
caller (that has a strvec), so the loss of flexibility is unlikely to
ever matter.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
