<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/packfile.c, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-04-08T17:19:17Z</updated>
<entry>
<title>Merge branch 'ps/odb-cleanup'</title>
<updated>2026-04-08T17:19:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-08T17:19:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9797fed6cea706f65de64396222545d545226e15'/>
<id>urn:sha1:9797fed6cea706f65de64396222545d545226e15</id>
<content type='text'>
Various code clean-up around odb subsystem.

* ps/odb-cleanup:
  odb: drop unneeded headers and forward decls
  odb: rename `odb_has_object()` flags
  odb: use enum for `odb_write_object` flags
  odb: rename `odb_write_object()` flags
  treewide: use enum for `odb_for_each_object()` flags
  CodingGuidelines: document our style for flags
</content>
</entry>
<entry>
<title>Merge branch 'tb/stdin-packs-excluded-but-open'</title>
<updated>2026-04-06T22:42:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-06T22:42:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=03311dca7f91f69e9e0c532fce1c1e3c0a9fa34d'/>
<id>urn:sha1:03311dca7f91f69e9e0c532fce1c1e3c0a9fa34d</id>
<content type='text'>
pack-objects's --stdin-packs=follow mode learns to handle
excluded-but-open packs.

* tb/stdin-packs-excluded-but-open:
  repack: mark non-MIDX packs above the split as excluded-open
  pack-objects: support excluded-open packs with --stdin-packs
  t7704: demonstrate failure with once-cruft objects above the geometric split
  pack-objects: refactor `read_packs_list_from_stdin()` to use `strmap`
  pack-objects: plug leak in `read_stdin_packs()`
</content>
</entry>
<entry>
<title>treewide: use enum for `odb_for_each_object()` flags</title>
<updated>2026-04-01T03:43:13Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-31T23:57:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=75c702624d9a5f60a78c2d4d5e8de83468c9c5ec'/>
<id>urn:sha1:75c702624d9a5f60a78c2d4d5e8de83468c9c5ec</id>
<content type='text'>
We've got a couple of callsites where we pass `odb_for_each_object()`
flags, but accept an `unsigned` flags field instead of the corresponding
enum. Adapt these to accept the enum type instead.

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>pack-objects: support excluded-open packs with --stdin-packs</title>
<updated>2026-03-27T20:40:40Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2026-03-27T20:06:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3f7c0e722e2733aede32b1e531caf83e7043d1bd'/>
<id>urn:sha1:3f7c0e722e2733aede32b1e531caf83e7043d1bd</id>
<content type='text'>
In cd846bacc7d (pack-objects: introduce '--stdin-packs=follow',
2025-06-23), pack-objects learned to traverse through commits in
included packs when using '--stdin-packs=follow', rescuing reachable
objects from unlisted packs into the output.

When we encounter a commit in an excluded pack during this rescuing
phase we will traverse through its parents. But because we set
`revs.no_kept_objects = 1`, commit simplification will prevent us from
showing it via `get_revision()`. (In practice, `--stdin-packs=follow`
walks commits down to the roots, but only opens up trees for ones that
do not appear in an excluded pack.)

But there are certain cases where we *do* need to see the parents of an
object in an excluded pack. Namely, if an object is rescue-able, but
only reachable from object(s) which appear in excluded packs, then
commit simplification will exclude those commits from the object
traversal, and we will never see a copy of that object, and thus not
rescue it.

This is what causes the failure in the previous commit during repacking.
When performing a geometric repack, packs above the geometric split that
weren't part of the previous MIDX (e.g., packs pushed directly into
`$GIT_DIR/objects/pack`) may not have full object closure.  When those
packs are listed as excluded via the '^' marker, the reachability
traversal encounters the sequence described above, and may miss objects
which we expect to rescue with `--stdin-packs=follow`.

Introduce a new "excluded-open" pack prefix, '!'. Like '^'-prefixed
packs, objects from '!'-prefixed packs are excluded from the resulting
pack. But unlike '^', commits in '!'-prefixed packs *are* used as
starting points for the follow traversal, and the traversal does not
treat them as a closure boundary.

In order to distinguish excluded-closed from excluded-open packs during
the traversal, introduce a new `pack_keep_in_core_open` bit on
`struct packed_git`, along with a corresponding `KEPT_PACK_IN_CORE_OPEN`
flag for the kept-pack cache.

In `add_object_entry_from_pack()`, move the `want_object_in_pack()`
check to *after* `add_pending_oid()`. This is necessary so that commits
from excluded-open packs are added as traversal tips even though their
objects won't appear in the output. As a consequence, the caller
`for_each_object_in_pack()` will always provide a non-NULL 'p', hence we
are able to drop the "if (p)" conditional.

The `include_check` and `include_check_obj` callbacks on `rev_info` are
used to halt the walk at closed-excluded packs, since objects behind a
'^' boundary are guaranteed to have closure and need not be rescued.

The following commit will make use of this new functionality within the
repack layer to resolve the test failure demonstrated in the previous
commit.

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object-file: move logic to compute packed abbreviation length</title>
<updated>2026-03-20T20:16:42Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-20T07:07:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6c2ede6e4abed754bb5891c2904212c05efcfb11'/>
<id>urn:sha1:6c2ede6e4abed754bb5891c2904212c05efcfb11</id>
<content type='text'>
Same as the preceding commit, move the logic that computes the minimum
required prefix length to make a given object ID unique for the packfile
store into a new function `packfile_store_find_abbrev_len()` that is
part of "packfile.c". This prepares for making the logic fully generic
via pluggable object databases.

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>object-name: move logic to iterate through packed prefixed objects</title>
<updated>2026-03-20T20:16:42Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-20T07:07:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e30bff8f8402f0f147a08fe00b75e24f293fa870'/>
<id>urn:sha1:e30bff8f8402f0f147a08fe00b75e24f293fa870</id>
<content type='text'>
Similar to the preceding commit, move the logic to iterate through
objects that have a given prefix into "packfile.c".

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>odb: introduce `struct odb_for_each_object_options`</title>
<updated>2026-03-20T20:16:41Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-20T07:07:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cfd575f0a9730712107e4ee6799a37665bcd8204'/>
<id>urn:sha1:cfd575f0a9730712107e4ee6799a37665bcd8204</id>
<content type='text'>
The `odb_for_each_object()` function only accepts a bitset of flags. In
a subsequent commit we'll want to change object iteration to also
support iterating over only those objects that have a specific prefix.
While we could of course add the prefix to the function signature, or
alternatively introduce a new function, both of these options don't
really seem to be that sensible.

Instead, introduce a new `struct odb_for_each_object_options` that can
be passed to a new `odb_for_each_object_ext()` function. Splice through
the options structure into the respective object database sources.

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/odb-sources'</title>
<updated>2026-03-12T21:09:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-12T21:09:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c89a495ce4c508db4dd798050b9115ad103711c7'/>
<id>urn:sha1:c89a495ce4c508db4dd798050b9115ad103711c7</id>
<content type='text'>
The object source API is getting restructured to allow plugging new
backends.

* ps/odb-sources:
  odb/source: make `begin_transaction()` function pluggable
  odb/source: make `write_alternate()` function pluggable
  odb/source: make `read_alternates()` function pluggable
  odb/source: make `write_object_stream()` function pluggable
  odb/source: make `write_object()` function pluggable
  odb/source: make `freshen_object()` function pluggable
  odb/source: make `for_each_object()` function pluggable
  odb/source: make `read_object_stream()` function pluggable
  odb/source: make `read_object_info()` function pluggable
  odb/source: make `close()` function pluggable
  odb/source: make `reprepare()` function pluggable
  odb/source: make `free()` function pluggable
  odb/source: introduce source type for robustness
  odb: move reparenting logic into respective subsystems
  odb: embed base source in the "files" backend
  odb: introduce "files" source
  odb: split `struct odb_source` into separate header
</content>
</entry>
<entry>
<title>odb: introduce generic object counting</title>
<updated>2026-03-12T15:38:43Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-12T08:43:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6801ffd37df8420917e1feaf03b5f7c175798bff'/>
<id>urn:sha1:6801ffd37df8420917e1feaf03b5f7c175798bff</id>
<content type='text'>
Similar to the preceding commit, introduce counting of objects on the
object database level, replacing the logic that we have in
`repo_approximate_object_count()`.

Note that the function knows to cache the object count. It's unclear
whether this cache is really required as we shouldn't have that many
cases where we count objects repeatedly. But to be on the safe side the
caching mechanism is retained, with the only excepting being that we
also have to use the passed flags as caching key.

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>odb/source: introduce generic object counting</title>
<updated>2026-03-12T15:38:42Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-03-12T08:43:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b259f2175b0ccd5574fc6b06b8ec5cbeaa860610'/>
<id>urn:sha1:b259f2175b0ccd5574fc6b06b8ec5cbeaa860610</id>
<content type='text'>
Introduce generic object counting on the object database source level
with a new backend-specific callback function.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
