aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/cat-file.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-12-03 15:44:00 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-04 08:21:54 +0900
commitc87910b96b1223d4a1dfe65c04e03863fadef6bc (patch)
tree4fbd9e0eda5efb0be743f8b354e19200253d52a1 /builtin/cat-file.c
parentpackfile: pass down repository to `has_object[_kept]_pack` (diff)
downloadgit-c87910b96b1223d4a1dfe65c04e03863fadef6bc.tar.gz
git-c87910b96b1223d4a1dfe65c04e03863fadef6bc.zip
packfile: pass down repository to `for_each_packed_object`
The function `for_each_packed_object` currently relies on the global variable `the_repository`. To eliminate global variable usage in `packfile.c`, we should progressively shift the dependency on the_repository to higher layers. Let's remove its usage from this function and closely related function `is_promisor_object`. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/cat-file.c')
-rw-r--r--builtin/cat-file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index bfdfb51c7c..d67b101c20 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -827,15 +827,16 @@ static int batch_objects(struct batch_options *opt)
cb.seen = &seen;
for_each_loose_object(batch_unordered_loose, &cb, 0);
- for_each_packed_object(batch_unordered_packed, &cb,
- FOR_EACH_OBJECT_PACK_ORDER);
+ for_each_packed_object(the_repository, batch_unordered_packed,
+ &cb, FOR_EACH_OBJECT_PACK_ORDER);
oidset_clear(&seen);
} else {
struct oid_array sa = OID_ARRAY_INIT;
for_each_loose_object(collect_loose_object, &sa, 0);
- for_each_packed_object(collect_packed_object, &sa, 0);
+ for_each_packed_object(the_repository, collect_packed_object,
+ &sa, 0);
oid_array_for_each_unique(&sa, batch_object_cb, &cb);