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

Re: [PATCH] cat-file: speed up default format

From
Jeff King <peff@peff.net>
Date
Jun 16, 2026, 11:15 UTC
Message-ID
<20260616111534.GB687438@coredump.intra.peff.net>
In-Reply-To
<df933ffa-1be2-4401-a4ac-9d72c9c4cdcc@web.de>
On Mon, Jun 15, 2026 at 11:53:10PM +0200, René Scharfe wrote:
Show 6 quoted lines
> >  	} else if (is_atom("rest", atom, len)) {
> > -		if (data->mark_query)
> > -			data->split_on_whitespace = 1;
> > -		else if (data->rest)
> 
> This removes support for rest being NULL, breaking t1006.381.
Yup. I did say "only lightly tested". ;)
The fix is obviously just:
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 9cc7ec7a6f..370ca6d771 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -363,7 +363,8 @@ static void objectsize_disk_add(struct format_item *item UNUSED,
 static void rest_add(struct format_item *item UNUSED,
 		     struct strbuf *sb, struct expand_data *data)
 {
-	strbuf_addstr(sb, data->rest);
+	if (data->rest)
+		strbuf_addstr(sb, data->rest);
 }
 
 static void deltabase_add(struct format_item *item UNUSED,

I think perhaps this error shows that the mark_query thing in the
existing code obfuscates the logic a bit.

-Peff
Previous: René Scharfe
Message 10 of 10 in “cat-file: speed up default format”
  1. cat-file: speed up default formatRené Scharfe, Jun 14, 2026
  2. Patrick SteinhardtJun 15, 2026
  3. Jeff KingJun 15, 2026
  4. Jeff KingJun 15, 2026
  5. René ScharfeJun 15, 2026
  6. Jeff KingJun 16, 2026
  7. René ScharfeJun 16, 2026
  8. Junio C HamanoJun 16, 2026
  9. René ScharfeJun 15, 2026
  10. Jeff KingJun 16, 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.