[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