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>
This commit is contained in:

committed by
Junio C Hamano

parent
cc656f4eb2
commit
c87910b96b
@ -3858,7 +3858,8 @@ static void show_object__ma_allow_promisor(struct object *obj, const char *name,
|
||||
* Quietly ignore EXPECTED missing objects. This avoids problems with
|
||||
* staging them now and getting an odd error later.
|
||||
*/
|
||||
if (!has_object(the_repository, &obj->oid, 0) && is_promisor_object(&obj->oid))
|
||||
if (!has_object(the_repository, &obj->oid, 0) &&
|
||||
is_promisor_object(to_pack.repo, &obj->oid))
|
||||
return;
|
||||
|
||||
show_object(obj, name, data);
|
||||
@ -3927,7 +3928,9 @@ static int add_object_in_unpacked_pack(const struct object_id *oid,
|
||||
|
||||
static void add_objects_in_unpacked_packs(void)
|
||||
{
|
||||
if (for_each_packed_object(add_object_in_unpacked_pack, NULL,
|
||||
if (for_each_packed_object(to_pack.repo,
|
||||
add_object_in_unpacked_pack,
|
||||
NULL,
|
||||
FOR_EACH_OBJECT_PACK_ORDER |
|
||||
FOR_EACH_OBJECT_LOCAL_ONLY |
|
||||
FOR_EACH_OBJECT_SKIP_IN_CORE_KEPT_PACKS |
|
||||
|
Reference in New Issue
Block a user