diff options
author | Taylor Blau <me@ttaylorr.com> | 2017-10-02 09:10:34 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-05 10:41:57 +0900 |
commit | bea4dbeafda3ddc4404f2e94dce0b66a4105399a (patch) | |
tree | 6efc5ff1eb48fffef29c26cdf7d166af51292826 /t | |
parent | Git 2.14.2 (diff) | |
download | tgif-bea4dbeafda3ddc4404f2e94dce0b66a4105399a.tar.xz |
ref-filter.c: pass empty-string as NULL to atom parsers
Peff points out that different atom parsers handle the empty
"sub-argument" list differently. An example of this is the format
"%(refname:)".
Since callers often use `string_list_split` (which splits the empty
string with any delimiter as a 1-ary string_list containing the empty
string), this makes handling empty sub-argument strings non-ergonomic.
Let's fix this by declaring that atom parser implementations must
not care about distinguishing between the empty string "%(refname:)"
and no sub-arguments "%(refname)". Current code aborts, either with
"unrecognised arg" (e.g. "refname:") or "does not take args"
(e.g. "body:") as an error message.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t6300-for-each-ref.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 2274a4b733..edc1bd8eab 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -51,6 +51,7 @@ test_atom() { } test_atom head refname refs/heads/master +test_atom head refname: refs/heads/master test_atom head refname:short master test_atom head refname:lstrip=1 heads/master test_atom head refname:lstrip=2 master |