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

Re: [PATCH v2 2/2] list-objects-filter-options: avoid strbuf_split_str()

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 11, 2026, 18:07 UTC
Message-ID
<xmqqo6kup7cw.fsf@gitster.g>
In-Reply-To
<20260311174548.GA1900488@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I don't think this is quite right. After we skip the first "+" and "p"
> points to the second one, then strchrnul() will find that second "+",
> not NUL. And so we have a 0-length spec, and feed the empty string to
> parse_combine_subfilter(), which complains.

Ah, I misread gently_parse_list_objects_fiter(), which makes a NULL arg a silent no-op, but fully complains on an empty string. Thanks.

Show 7 quoted lines
> But yeah, it is somewhat inconsistent that we complain about an empty
> spec in the middle, but not at the end. If we were starting from
> scratch, I'd probably forbid it everywhere. But since we allow it in
> some cases now, it may be worth being more permissive.
>
> It is easy to check in the loop, or even just teach the helper to make
> empty specs a noop:
Yup.
Previous: Jeff KingNext: Deveshi Dwivedi
Message 6 of 11 in “avoid unnecessary strbuf_split*() and strbuf-by-value usage”
  1. 0/2 avoid unnecessary strbuf_split*() and strbuf-by-value usageDeveshi Dwivedi, Mar 11, 2026
  2. 1/2 worktree: do not pass strbuf by valueDeveshi Dwivedi, Mar 11, 2026
  3. 2/2 list-objects-filter-options: avoid strbuf_split_str()Deveshi Dwivedi, Mar 11, 2026
  4. Junio C HamanoMar 11, 2026
  5. Jeff KingMar 11, 2026
  6. Junio C HamanoMar 11, 2026
  7. 0/2 avoid unnecessary strbuf_split*() and strbuf-by-value usageDeveshi Dwivedi, Mar 11, 2026
  8. 1/2 worktree: do not pass strbuf by valueDeveshi Dwivedi, Mar 11, 2026
  9. 2/2 list-objects-filter-options: avoid strbuf_split_str()Deveshi Dwivedi, Mar 11, 2026
  10. Jeff KingMar 11, 2026
  11. Junio C HamanoMar 11, 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.