Re: [PATCH 5/6] gitignore: do not do basename match with patterns that have '**'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 5, 2012 at 2:01 PM, Johannes Sixt <j.sixt@xxxxxxxxxxxxx> wrote:
> Am 10/4/2012 9:39, schrieb Nguyễn Thái Ngọc Duy:
>> - - If the pattern does not contain a slash '/', git treats it as
>> -   a shell glob pattern and checks for a match against the
>> -   pathname relative to the location of the `.gitignore` file
>> -   (relative to the toplevel of the work tree if not from a
>> -   `.gitignore` file).
>> + - If the pattern does not contain a slash '/' nor '**', git
>> +   treats it as a shell glob pattern and checks for a match
>> +   against the pathname relative to the location of the
>> +   `.gitignore` file (relative to the toplevel of the work tree
>> +   if not from a `.gitignore` file).

I think in the latest round, we forbid this case (i.e. a/**, **/b and
a/**/b are ok, but a**b is not), exactly because it's hard to define
how it should do. Thanks for another example.

>> +test_expect_success '"**" with no slashes test' '
>> +     echo "a**f foo=bar" >.gitattributes &&
>> +     cat <<\EOF >expect &&
>> +f: foo: unspecified
>> +a/f: foo: bar
>> +a/b/f: foo: bar
>> +a/b/c/f: foo: bar
>> +EOF
>
> Should the above .gitattributes match nested paths, such as b/a/c/f?
>
> I think it should, because the user can easily say "/a**f" that nested
> paths should not be matched.

The user can also say **/a/**f to match b/a/c/f.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]