Re: [PATCH 2/2] reflog: implement subcommand to drop reflogs
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 7, 2025, 12:59 UTC
- Message-ID
- <Z8rtuZysCngh5FQd@pks.im>
- In-Reply-To
- <CAOLa=ZSMLwt53TwziCe71UbKWgRyNgg5VvUwTUUDkN60ymmFPA@mail.gmail.com>
On Fri, Mar 07, 2025 at 06:53:31AM -0600, Karthik Nayak wrote:
Show 22 quoted lines
> Patrick Steinhardt <ps@pks.im> 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