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

Re: [PATCH] commit-reach: stop sorting in paint_down_to_common()

From
Jeff King <peff@peff.net>
Date
May 29, 2026, 19:04 UTC
Message-ID
<20260529190453.GA1711766@coredump.intra.peff.net>
In-Reply-To
<107314f5-0057-4ed3-9bee-9dca4f424bd1@web.de>
On Fri, May 29, 2026 at 05:32:58PM +0200, René Scharfe wrote:
Show 6 quoted lines
> > Seems like an easy win. If some of the callers do not even look at the
> > result, could we avoid building it at all in those cases (e.g., by
> > passing in a NULL result pointer)?
> 
> Yes, at the cost of adding NULL checks to paint_down_to_common().  Which
> is probably worth it.

Yeah. I thought it was only one line (where we append to "tail"), but there are a couple spots where "result" is referenced directly.

Another fun fact: it looks like paint_down_to_common() makes sure to clean up the output list before returning an error. But the callers do so, too, which is redundant. That would go away if they just passed in NULL. :)

-Peff
Previous: René Scharfe
Message 4 of 4 in “commit-reach: stop sorting in paint_down_to_common()”
  1. commit-reach: stop sorting in paint_down_to_common()René Scharfe, May 27, 2026
  2. Jeff KingMay 29, 2026
  3. René ScharfeMay 29, 2026
  4. Jeff KingMay 29, 2026

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.