diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-07-17 06:56:40 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-16 22:16:17 -0700 |
| commit | 0df005353aca4e490478a4e8c2d090728599868e (patch) | |
| tree | 25e7352de22a170fa7aabdc27130fbd227517df2 /object-file.h | |
| parent | d81712ce65f7ee59ce88c8b74f09b6e6456a6f3c (diff) | |
| download | git-0df005353aca4e490478a4e8c2d090728599868e.tar.xz | |
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>
Diffstat (limited to 'object-file.h')
| -rw-r--r-- | object-file.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/object-file.h b/object-file.h index 1b1ab95423..52f7979267 100644 --- a/object-file.h +++ b/object-file.h @@ -210,7 +210,8 @@ int check_and_freshen_file(const char *fn, int freshen); * * Returns 0 on success, negative on error (details may be written to stderr). */ -int read_loose_object(const char *path, +int read_loose_object(struct repository *repo, + const char *path, const struct object_id *expected_oid, struct object_id *real_oid, void **contents, |
