<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/object-file.c, branch v2.51.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.51.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.51.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-07-17T05:16:18Z</updated>
<entry>
<title>object-file: get rid of `the_repository` in index-related functions</title>
<updated>2025-07-17T05:16:18Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5f2e994e34ab83c90c1c5f3b31c1573b37cb137b'/>
<id>urn:sha1:5f2e994e34ab83c90c1c5f3b31c1573b37cb137b</id>
<content type='text'>
Both `index_fd()` and `index_path()` still use `the_repository` even
though they have a repository available via `struct index_state`. Adapt
them so that they use the index' repository instead to get rid of this
global dependency.

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-file: get rid of `the_repository` in `force_object_loose()`</title>
<updated>2025-07-17T05:16:17Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c2b5d1490a4b6b8b1a50b9ef82ec204811d7ccf1'/>
<id>urn:sha1:c2b5d1490a4b6b8b1a50b9ef82ec204811d7ccf1</id>
<content type='text'>
The function `force_object_loose()` forces an object to become a loose
object in case it only exists in its packed form. To do so it implicitly
relies on `the_repository`.

Refactor the function by passing a `struct odb_source` as parameter.
While the check whether any such loose object exists already acts on the
whole object database, writing the loose object happens in one specific
source.

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-file: get rid of `the_repository` in `read_loose_object()`</title>
<updated>2025-07-17T05:16:17Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0df005353aca4e490478a4e8c2d090728599868e'/>
<id>urn:sha1:0df005353aca4e490478a4e8c2d090728599868e</id>
<content type='text'>
The function `read_loose_object()` takes a path to an object file and
tries to parse it. As such, the function does not depend on any specific
object database but instead acts as an ODB-independent way to read a
specific file. As such, all it needs as input is a repository so that we
can derive repo settings and the hash algorithm.

That repository isn't passed in as a parameter though, as we implicitly
depend on the global `the_repository`. Refactor the function so that we
pass in the repository as a parameter.

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-file: get rid of `the_repository` in loose object iterators</title>
<updated>2025-07-17T05:16:17Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d81712ce65f7ee59ce88c8b74f09b6e6456a6f3c'/>
<id>urn:sha1:d81712ce65f7ee59ce88c8b74f09b6e6456a6f3c</id>
<content type='text'>
The iterators for loose objects still rely on `the_repository`. Refactor
them:

  - `for_each_loose_file_in_objdir()` is refactored so that the caller
    is now expected to pass an `odb_source` as parameter instead of the
    path to that source. Furthermore, it is renamed accordingly to
    `for_each_loose_file_in_source()`.

  - `for_each_loose_object()` is refactored to take in an object
    database now and calls the above function in a loop.

This allows us to get rid of the global dependency.

Adjust callers accordingly.

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-file: remove declaration for `for_each_file_in_obj_subdir()`</title>
<updated>2025-07-17T05:16:16Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=83439299f1326c7471f5c7595c96d14b65a71879'/>
<id>urn:sha1:83439299f1326c7471f5c7595c96d14b65a71879</id>
<content type='text'>
The function `for_each_file_in_obj_subdir()` is declared in our headers,
but it is not used anywhere else than in the corresponding code file
itself. Drop the declaration and mark the function as file-local.

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-file: inline `for_each_loose_file_in_objdir_buf()`</title>
<updated>2025-07-17T05:16:16Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f2c40e51b235b3814475d3988782ae5dfcae8752'/>
<id>urn:sha1:f2c40e51b235b3814475d3988782ae5dfcae8752</id>
<content type='text'>
The function `for_each_loose_file_in_objdir_buf()` is declared in our
headers, but it is not used anywhere else than in the corresponding code
file itself. Drop the declaration and inline the function into its only
caller.

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-file: get rid of `the_repository` when writing objects</title>
<updated>2025-07-17T05:16:16Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e7e952f5c27bbca3d98bbcea6d20cd5b63d7d8e5'/>
<id>urn:sha1:e7e952f5c27bbca3d98bbcea6d20cd5b63d7d8e5</id>
<content type='text'>
The logic that writes loose objects still relies on `the_repository` to
decide where exactly the object shall be written to. Refactor it so that
the logic instead operates on a `struct odb_source` so that we can get
rid of this global dependency.

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 `odb_write_object()`</title>
<updated>2025-07-17T05:16:15Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ab1c6e1d12e869cbca3ea7f8a4e767e45fd14c49'/>
<id>urn:sha1:ab1c6e1d12e869cbca3ea7f8a4e767e45fd14c49</id>
<content type='text'>
We do not have a backend-agnostic way to write objects into an object
database. While there is `write_object_file()`, this function is rather
specific to the loose object format.

Introduce `odb_write_object()` to plug this gap. For now, this function
is a simple wrapper around `write_object_file()` and doesn't even use
the passed-in object database yet. This will change in subsequent
commits, where `write_object_file()` is converted so that it works on
top of an `odb_source`. `odb_write_object()` will then become
responsible for deciding which source an object shall be written to.

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>loose: write loose objects map via their source</title>
<updated>2025-07-17T05:16:15Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0f9b18935745fcdebcad613a6e3e52db5b29b1d4'/>
<id>urn:sha1:0f9b18935745fcdebcad613a6e3e52db5b29b1d4</id>
<content type='text'>
When a repository is configured to have a compatibility hash algorithm
we keep track of object ID mappings for loose objects via the loose
object map. This map simply maps an object ID of the actual hash to the
object ID of the compatibility hash. This loose object map is an
inherent property of the loose files backend and thus of one specific
object source.

Refactor the interfaces to reflect this by requiring a `struct
odb_source` as input instead of a repository. This prepares for
subsequent commits where we will refactor writing of loose objects to
work on a `struct odb_source`, as well.

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-file: get rid of `the_repository` in `finalize_object_file()`</title>
<updated>2025-07-17T05:16:14Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbb388f3e53660c88220c40a8dddb976672ae03d'/>
<id>urn:sha1:cbb388f3e53660c88220c40a8dddb976672ae03d</id>
<content type='text'>
We implicitly depend on `the_repository` when moving an object file into
place in `finalize_object_file()`. Get rid of this global dependency by
passing in a repository.

Note that one might be pressed to inject an object database instead of a
repository. But the function doesn't really care about the ODB at all.
All it does is to move a file into place while checking whether there is
any collision. As such, the functionality it provides is independent of
the object database and only needs the repository as parameter so that
it can adjust permissions of the file we are about to finalize.

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