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

[PATCH 0/1] ref-filter.c: pass empty-string as NULL to atom parsers

From
Taylor Blau <me@ttaylorr.com>
Date
Oct 2, 2017, 05:50 UTC
Message-ID
<20171002055052.GB10729@D-10-157-251-166.dhcp4.washington.edu>
Hi,

Attached is a one-long patch series to un-distinguish between atoms without sub-arguments ("%(refname)") and atoms with empty sub-argument lists ("%(refname:)").

This addresses a user-experience issue that Peff points out:
Show 12 quoted lines
> Doh, that string_list behavior is what I was missing in my earlier
> comments. I agree this is probably the best way of doing it. I'm tempted
> to say that parse_ref_filter_atom() should do a similar thing. Right now
> we've got:
>
>   $ git for-each-ref --format='%(refname)' | wc
>      2206    2206   79929
>   $ git for-each-ref --format='%(refname:short)' | wc
>      2206    2206   53622
>   $ git for-each-ref --format='%(refname:)' | wc
>   fatal: unrecognized %(refname:) argument:
>       0       0       0

By treating %(refname) and %(refname:) as the same thing. Peff has convinced me that these _are_ indeed the same thing, as the first is a %(refname) atom without any sub-arguments, and the later is a %(refname) %atom with empty sub-arguments.

The reasoning is highlighted in the comment this patch adds, which makes more ergonomic the use of string_list_split in atom parser implementations.

Thank you in advance :-).
--
- Taylor
Next: Taylor Blau
Message 1 of 12 in “ref-filter.c: pass empty-string as NULL to atom parsers”
  1. 0/1 ref-filter.c: pass empty-string as NULL to atom parsersTaylor Blau, Oct 2, 2017
  2. ref-filter.c: pass empty-string as NULL to atom parsersTaylor Blau, Oct 2, 2017
  3. Jeff KingOct 2, 2017
  4. Taylor BlauOct 2, 2017
  5. Jeff KingOct 2, 2017
  6. ref-filter.c: pass empty-string as NULL to atom parsersTaylor Blau, Oct 2, 2017
  7. Jeff KingOct 2, 2017
  8. Jonathan NiederOct 2, 2017
  9. Junio C HamanoOct 2, 2017
  10. Taylor BlauOct 3, 2017
  11. Junio C HamanoOct 5, 2017
  12. Jonathan NiederOct 5, 2017

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.