git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 13, 2025, 14:45 UTC
Message-ID
<Z9Lvc2YKr5jD5D6h@pks.im>
In-Reply-To
<CAOLa=ZQ3Rgi+yyma0Zo6uK04eu9Lk1dk_uYTU-4hFfh9POTNYA@mail.gmail.com>
On Thu, Mar 13, 2025 at 09:24:16AM -0500, Karthik Nayak wrote:
Show 16 quoted lines
> Patrick Steinhardt <ps@pks.im> 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
Previous: Karthik NayakNext: Karthik Nayak
Message 21 of 30 in “EDITME: cover title for 493-add-command-to-purge-reflog-entries”
  1. 0/2 EDITME: cover title for 493-add-command-to-purge-reflog-entriesKarthik Nayak, Mar 7, 2025
  2. 1/2 reflog: drop usage of global variablesKarthik Nayak, Mar 7, 2025
  3. Junio C HamanoMar 7, 2025
  4. Karthik NayakMar 10, 2025
  5. Junio C HamanoMar 10, 2025
  6. Karthik NayakMar 13, 2025
  7. 2/2 reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 7, 2025
  8. Patrick SteinhardtMar 7, 2025
  9. Karthik NayakMar 7, 2025
  10. Patrick SteinhardtMar 7, 2025
  11. Karthik NayakMar 7, 2025
  12. Karthik NayakMar 7, 2025
  13. Junio C HamanoMar 7, 2025
  14. Karthik NayakMar 10, 2025
  15. Kristoffer HaugsbakkMar 10, 2025
  16. Karthik NayakMar 10, 2025
  17. Junio C HamanoMar 10, 2025
  18. reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 10, 2025
  19. Patrick SteinhardtMar 12, 2025
  20. Karthik NayakMar 13, 2025
  21. Patrick SteinhardtMar 13, 2025
  22. 0/2 reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 14, 2025
  23. 1/2 reflog: improve error for when reflog is not foundKarthik Nayak, Mar 14, 2025
  24. 2/2 reflog: implement subcommand to drop reflogsKarthik Nayak, Mar 14, 2025
  25. Christian CouderMar 18, 2025
  26. Junio C HamanoMar 18, 2025
  27. Christian CouderMar 19, 2025
  28. Karthik NayakMar 19, 2025
  29. Toon ClaesMar 18, 2025
  30. Karthik NayakMar 19, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.