From 0df005353aca4e490478a4e8c2d090728599868e Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 17 Jul 2025 06:56:40 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- object-file.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'object-file.h') 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, -- cgit v1.3