Re: [RFC/PATCH] pathspec: allow escaped query values
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 2, 2016, 16:10 UTC
- Message-ID
- <xmqqoa7jvag0.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <57505105.2000801@ramsayjones.plus.com>
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
Show 6 quoted lines
> So, at risk of annoying you, let me continue in my ignorance a little > longer and ask: even if you have to protect all of this 'magic' from > the shell with '/" quoting, could you not use (nested) quotes to > protect the <value> part of an <attr>? For example: > > git ls-files ':(attr:whitespace="indent,trail,space",icase)'
That would be workable, I would think. Before attr:VAR=VAL extention, supported pathspec <magic> were only single lowercase-ascii alphabet tokens, so nobody would have used " as a part of magic. So quting with double-quote pair would work.
You'd need to come up with a way to quote a double quote that happens to be a part of VAL somehow, though. I think attribute value is limited to a string with non-whitespace letters; even though the built-in attributes that have defined meaning to the Git itself may not use values with letters beyond [-a-zA-Z0-9,], end users and projects can add arbitrary values within the allowed syntax, so it is not unconceivable that some project may have a custom attribute that lists forbidden characters in a path with
=== .gitattributes ===
*.txt forbidden=`"that tells their documentation cannot have these letters in it, or something like that.