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

Re: [PATCHv4] pathspec: allow escaped query values

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 3, 2016, 20:39 UTC
Message-ID
<xmqqzir2nh1g.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160603191930.16973-1-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 34 quoted lines
> In our own .gitattributes file we have attributes such as:
>
>     *.[ch] whitespace=indent,trail,space
>
> When querying for attributes we want to be able to ask for the exact
> value, i.e.
>
>     git ls-files :(attr:whitespace=indent,trail,space)
>
> should work, but the commas are used in the attr magic to introduce
> the next attr, such that this query currently fails with
>
> fatal: Invalid pathspec magic 'trail' in ':(attr:whitespace=indent,trail,space)'
>
> This change allows escaping characters by a backslash, such that the query
>
>     git ls-files :(attr:whitespace=indent\,trail\,space)
>
> will match all path that have the value "indent,trail,space" for the
> whitespace attribute. To accomplish this, we need to modify two places.
> First `eat_long_magic` needs to not stop early upon seeing a comma or
> closing paren that is escaped. As a second step we need to remove any
> escaping from the attr value.
>
> Helped-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>
> differences to v3 (http://thread.gmane.org/gmane.comp.version-control.git/296259):
> * lose the *src check before invalid_value_char
> * remove a stray new line in parse_pathspec_attr_match
>
> Thanks,
> Stefan
Excellent.  Thanks.
Previous: Stefan Beller
Message 2 of 2 in “[PATCHv4] pathspec: allow escaped query values”
  1. Stefan BellerJun 3, 2016
  2. Junio C HamanoJun 3, 2016

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.