Subject: Re: [PATCH 2/2] reflog: implement subcommand to drop reflogs

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 7 Mar 2025 13:59:37 +0100

On Fri, Mar 07, 2025 at 06:53:31AM -0600, Karthik Nayak wrote:
> Patrick Steinhardt <[email-masked]> writes:
> > On Fri, Mar 07, 2025 at 12:17:26PM +0100, Karthik Nayak wrote:
> >> @@ -447,10 +456,56 @@ static int cmd_reflog_exists(int argc, const char **argv, const char *prefix,
> >>  				   refname);
> >>  }
> >>
> >> +static int cmd_reflog_drop(int argc, const char **argv, const char *prefix,
> >> +			   struct repository *repo)
> >> +{
> >> +	int i, ret, do_all;
> >> +	const struct option options[] = {
> >> +		OPT_BOOL(0, "all", &do_all, N_("process the reflogs of all references")),
> >> +		OPT_END()
> >> +	};
> >> +
> >> +	do_all = ret = 0;
> >
> > Can't we initiailize the variables directly when declaring them?
> >
> 
> We can, let me fix it! I'll also move the initialization of 'i' down to
> the loop while we're here.

You can also avoid declaring `i` here at all and just declare it inside
the loop.

Patrick