Subject: Re: [PATCH v3 2/9] pack-objects: limit scope in 'add_object_entry_from_pack()'

From: Taylor Blau <[email-masked]>
Date: Wed, 16 Apr 2025 18:07:41 -0400

On Tue, Apr 15, 2025 at 10:31:26PM -0700, Elijah Newren wrote:
> On Tue, Apr 15, 2025 at 3:46 PM Taylor Blau <[email-masked]> wrote:
> >
> > 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 <[email-masked]>
> > ---
> >  builtin/pack-objects.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> > index 20dd870bbf..4ab695a3aa 100644
> > --- a/builtin/pack-objects.c
> > +++ b/builtin/pack-objects.c
> > @@ -3490,14 +3490,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,
> >                 return 0;
> >
> >         if (p) {
> > -               struct rev_info *revs = _data;
>
> This change is half of what you mention in your commit message.

Yeah, Junio noted the same in his review as well. See my response there
for a cleaner version of this patch.

Thanks,
Taylor