Re: [PATCH] cat-file: speed up default format
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