From: Junio C Hamano Date: Fri, 03 Jun 2016 20:39:23 GMT Subject: Re: [PATCHv4] pathspec: allow escaped query values Message-ID: In-Reply-To: <20160603191930.16973-1-sbeller@google.com> Stefan Beller writes: > 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 > Signed-off-by: Stefan Beller > --- > > 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.