diff mbox series

[07/20] packfile: use provided repository in `packed_object_info`

Message ID ee47c54eb763fc744667b195f4001cd67524c8c1.1729504641.git.karthik.188@gmail.com (mailing list archive)
State Superseded
Headers show
Series packfile: avoid using the 'the_repository' global variable | expand

Commit Message

karthik nayak Oct. 21, 2024, 9:57 a.m. UTC
The function `packed_object_info` receives a repository struct as an
argument. Yet, it still uses the global 'the_repository' variable
within, let's swap it with the provided repository variable.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 builtin/pack-objects.c | 2 +-
 packfile.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index a10eae239e..c2555d4986 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -3383,7 +3383,7 @@  static int add_object_entry_from_pack(const struct object_id *oid,
 		struct object_info oi = OBJECT_INFO_INIT;
 
 		oi.typep = &type;
-		if (packed_object_info(the_repository, p, ofs, &oi) < 0) {
+		if (packed_object_info(revs->repo, p, ofs, &oi) < 0) {
 			die(_("could not get type of object %s in pack %s"),
 			    oid_to_hex(oid), p->pack_name);
 		} else if (type == OBJ_COMMIT) {
diff --git a/packfile.c b/packfile.c
index ee46898b35..458db59b3a 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1604,7 +1604,7 @@  int packed_object_info(struct repository *r, struct packed_git *p,
 				goto out;
 			}
 		} else
-			oidclr(oi->delta_base_oid, the_repository->hash_algo);
+			oidclr(oi->delta_base_oid, r->hash_algo);
 	}
 
 	oi->whence = in_delta_base_cache(p, obj_offset) ? OI_DBCACHED :