Subject: Re: [PATCH/alternative/raw and rough] setup.c: denote repo wide pathspecs by ':'

From: Michael J Gruber <[email-masked]>
Date: Thu, 03 Mar 2011 09:20:02 +0100

Phil Hord venit, vidit, dixit 03.03.2011 04:44:
> On 03/02/2011 11:53 AM, Junio C Hamano wrote:
>> Michael J Gruber <[email-masked]> writes:
>>> [*] I keep forgetting that some people may have files whose names begin
>>> with ":". They are ambiguous now already with "treeish pathspec"
>>> commands, but not with "pathspec" commands. The latter would change.
>> Just to make sure I understand that they have easy workarounds:
>>
>>  - If you have a path foo/:bar, you can say
>>
>>    git log master -- foo/:bar
>>
>>    because ':' signals the magic and gets stripped only when it is at the
>>    beginning (i.e. not affecting foo/:bar); and
>>
>>  - For :boz at the root level, you can say
>>
>>    git log master -- '\:boz'
>>
>>    because the backslash in '\:boz' makes the colon not at the beginning and
>>    the glob match sees '\:boz' and then matches '\:' with literal ':' at the
>>    beginning of the pathname ":boz".
> 
> Easy workaround, maybe, but still a potential problem for unsuspecting
> scripts.
> 
>   - I think this fails in a directory with :foo.c
> 
>     git log master -- *.c
> 
> 
>   - Would this work, though?
> 
>     git log master -- "*.c"

I hope you are aware that these two are completely different before my
patch already, are you?

The second one will match ":foo.c" and any other .c-file at cwd in any
commit in master (which changes it), of course. No ambiguity here. This
is almost always what you want.

The first one would match ":foo.c" and any other .c file which you
currently have at cwd in your working tree (!), before my patch (unless
you don't have any in your wt), and is almost never what you want.

After my patch, it would interpret the ":foo.c" which the shell glob
expands to differently. That is exactly the ambiguity that I mentioned.

Michael