Re: [PATCH v2] reflog: implement subcommand to drop reflogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 13, 2025 at 09:24:16AM -0500, Karthik Nayak wrote:
> Patrick Steinhardt <ps@xxxxxx> writes:
> > On Mon, Mar 10, 2025 at 01:36:25PM +0100, Karthik Nayak wrote:
> >> +			continue;
> >> +		}
> >> +
> >> +		ret |= refs_delete_reflog(get_main_ref_store(repo), ref);
> >> +		free(ref);
> >> +	}
> >
> > The code is correct, but do we want to maybe wrap this loop in the
> > `else` branch to guide the reader and make it blindingly obvious that
> > the loop does nothing `if (do_all)`?
> >
> 
> Wouldn't it be simpler to return at the end of the `if (do_all)`? I've
> added that, but if feel strongly about this form, happy to change it.

I don't feel overly strong about it. I'm not a huge fan of early
returns as I think it's easier to reason about functions if they have a
common exit path. But I can live with whatever solution you come up
with.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux