]> git.ipfire.org Git - thirdparty/git.git/commit
object-file: get rid of `the_repository` in `read_loose_object()`
authorPatrick Steinhardt <ps@pks.im>
Thu, 17 Jul 2025 04:56:40 +0000 (06:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jul 2025 05:16:17 +0000 (22:16 -0700)
commit0df005353aca4e490478a4e8c2d090728599868e
tree25e7352de22a170fa7aabdc27130fbd227517df2
parentd81712ce65f7ee59ce88c8b74f09b6e6456a6f3c
object-file: get rid of `the_repository` in `read_loose_object()`

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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c
object-file.c
object-file.h