Re: [PATCH] gitattributes.txt: mention exceptions to gitignore rules

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

 



On Tue, 04 Jan 2011 11:17:14 -0800, Junio C Hamano wrote:

>> Patterns that do not match but should:
>>   d2/*
> 
> This shouldn't match unless it appears in d1/.gitattributes.
> 
> The presense of '/' makes the pattern anchored to the directory it
> appear in, and .git/info/attributes is taken as being at the top level.
> 

After more carefully re-reading gitignore(5) I think that now I get it.

I presume that is is not possible to match certain pattern occurring 
*anywhere* in the path.

Would it be possible to extend pattern format to include double-star 
wildcard that matches anything including slashes ?

Like: **/whatever/**

Many tools (in java at least) and libraries support such extension to 
globs. Unfortunately standard fnmatch(3) that's used by git is not one of 
them, but glibc's implementation looks portable and self-contained so it 
could be included and modified.


>>   d2/
>>   d2
> 
> These shouldn't for the same reason.
> 
>>   d1/d2
>>   /d1/d2
> 
> We somehow don't do leading path match like we do for gitignore, but I
> do not think this was intended.  My gut feeling is that these should
> match.
> 
> The thinking back, when we wrote the code, could have been that, unlike
> gitignore that maintains only one bit (either "ignored" or "not"),
> attributes are richer and giving the same attribute (say "whitespace
> checking criteria") to files inside a directory and the containing
> directory itself was nonsensical.  But if that was the reason, it is
> faulty, as we do not track directories anyway.
> 
> Wouldn't it be sufficient to teach attr.c:path_matches() that a pattern
> could also match with leading path?  That would automatically cover the
> case where a pattern is terminated with a slash, as pattern "d/e/" would
> never match path "d/e" but does match "d/e/f"?


--
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]