]> git.ipfire.org Git - thirdparty/git.git/commit
object-file: force objects loose via generic interface
authorPatrick Steinhardt <ps@pks.im>
Fri, 17 Jul 2026 09:32:15 +0000 (11:32 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 19 Jul 2026 02:03:48 +0000 (19:03 -0700)
commit627d3b7ab5dc76f0d4e4ef7a42184524df8f2ab1
treed1df647c6e9d4857234129a3e2b330ab6a48ed30
parent0e002f6dc74841324687284e6a3ae4a6061c0c73
object-file: force objects loose via generic interface

When repacking objects we may end up "loosening" objects via
`force_objects_loose()`. The implementation of this logic still sits
with "object-file.c" even though it is ultimately an implementation
detail of the "files" backend.

Moving this logic around is non-trivial though as we depend on
`write_loose_object()`, which is an internal implementation detail of
how we write loose objects. Until now it wasn't possible to use the
generic function `odb_source_write_object()` though, because the "loose"
implementation thereof would skip writing the object in case it already
exists in any other source.

This restriction was lifted over the preceding commits though, where
this object existence check is now handled on the object database level
and not on the individual source level anymore. Consequently, it is now
possible to use generic interfaces.

Refactor the code accordingly so that we can move the logic around in a
subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-file.c