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

Re: [PATCH v2] ref-filter.c: pass empty-string as NULL to atom parsers

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 5, 2017, 02:11 UTC
Message-ID
<20171005021148.GU19555@aiede.mtv.corp.google.com>
In-Reply-To
<xmqq376y9xf7.fsf@gitster.mtv.corp.google.com>
Junio C Hamano wrote:
Show 26 quoted lines
> From: Taylor Blau <me@ttaylorr.com>
> Date: Mon, 2 Oct 2017 09:10:34 -0700
> Subject: [PATCH] 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>
> ---
>  ref-filter.c            | 10 +++++++++-
>  t/t6300-for-each-ref.sh |  1 +
>  2 files changed, 10 insertions(+), 1 deletion(-)
Thanks for taking care of it.  This is indeed still
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Previous: Junio C Hamano
Message 12 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.