pack-objects: limit scope in 'add_object_entry_from_pack()'
In add_object_entry_from_pack() we declare 'revs' (given to us through the miscellaneous context argument) earlier in the "if (p)" conditional than is necessary. Move it down as far as it can go to reduce its scope. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
Jun 23, 2025 at 18:32 UTC
9809d4ae9f5b577e0afd18082b095414ce046c00
1 file changed
+1
-1
builtin/pack-objects.c
+1
-1
@@ -3725,7 +3725,6 @@ static int add_object_entry_from_pack(const struct object_id *oid,
3725
return 0;
3726
3727
if (p) {
3728
- struct rev_info *revs = _data;
3728
struct object_info oi = OBJECT_INFO_INIT;
3729
3730
oi.typep = &type;
@@ -3733,6 +3732,7 @@ static int add_object_entry_from_pack(const struct object_id *oid,
3732
die(_("could not get type of object %s in pack %s"),
3733
oid_to_hex(oid), p->pack_name);
3734
} else if (type == OBJ_COMMIT) {
3735
+ struct rev_info *revs = _data;
3736
/*
3737
* commits in included packs are used as starting points for the
3738
* subsequent revision walk