]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-objects: limit scope in 'add_object_entry_from_pack()'
authorTaylor Blau <me@ttaylorr.com>
Mon, 23 Jun 2025 22:32:13 +0000 (18:32 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Jun 2025 22:41:36 +0000 (15:41 -0700)
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>
builtin/pack-objects.c

index e7274e0e0094166ca5a45e45603e0a4a883060e4..d04a36a6bf3e5fc6e466cc4277c2e49e52fb4f9d 100644 (file)
@@ -3725,7 +3725,6 @@ static int add_object_entry_from_pack(const struct object_id *oid,
                return 0;
 
        if (p) {
-               struct rev_info *revs = _data;
                struct object_info oi = OBJECT_INFO_INIT;
 
                oi.typep = &type;
@@ -3733,6 +3732,7 @@ static int add_object_entry_from_pack(const struct object_id *oid,
                        die(_("could not get type of object %s in pack %s"),
                            oid_to_hex(oid), p->pack_name);
                } else if (type == OBJ_COMMIT) {
+                       struct rev_info *revs = _data;
                        /*
                         * commits in included packs are used as starting points for the
                         * subsequent revision walk