On Fri, Nov 22, 2013 at 6:55 AM, Junio C Hamano <gits...@pobox.com> wrote:
> Junio C Hamano <gits...@pobox.com> writes:
>
> An addendum.
>
>> As we can see in a later paragaph:
>>
>>     The "magic signature" consists of an ASCII symbol that is not
>>     alphanumeric. Currently only the slash `/` is recognized as a
>>     "magic signature"...
>>
>> the correct way to read that "a character that cannot be a magic
>> signature" is "a character that is not 'an ASCII symbol that is not
>> alphanumeric'", which means you can do:
>>
>>       :!/foo  - with magic signatures ! and /, pattern begins at 'f'
>>
>>       :/#abc  - with magic signatures # and /, pattern begins at 'a',
>>                 even if in a particular version of Git, '#' magic
>>                 signature may be invalid and produce an error
>>
>>       :/:#abc - with magic signature /, pattern is "#abc".
>>
>> but because the definition of "magic signature" syntax comes later
>> than "cannot be", it is prone to be misinterpreted as "anything that
>> is not currently defined as a magic signature (namely, '/')".
>
> ... and that misinterpretation may give a false impression that
>
>         ":/#abc"
>
> is with the magic signature '/' (i.e. match from top) for a pattern
> "#abc".
>
> Doing so would mean that a version of Git that does not support a
> magic signature '#' will allow people and scripts to use ":/#abc"
> with such a meaning, and will prevent us from using '#' as a new
> magic signature with some useful meaning in the future.  Rather, we
> need to force them to always spell it as ":/:#abc" even in the
> version of Git before the magic signature '#'.

Current version does force that.

$ git log -- ':/#aa'
fatal: Unimplemented pathspec magic '#' in ':/#aa'

Not sure if there are tests for it though. I'll add an advice to do ":/:#aa".

> And the phrasing 'if the pattern begins with a character that cannot
> be a "magic signature" and is not a colon' needs to be clarified to
> avoid that misinterpretation for that reason.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to