Patch Set 1:

This is a draft: javadocs are missing at all.

It turned out, that .gitattributes form a hierarchy, like .gitignores, so I didn't implement a Config-like solution. What is rather unpleasant is that .git/info/attributes has highest precedence. So it's a kind of stack with a fixed top-level element. This was the motivation to skip hierarchy from Attributes class at all and introduce AttributesQuery instead.

I think larger .gitattributes files at multiple levels of the tree may have significant impact on performance (what I've in mind are e.g. autogenerated .gitattributes files from svn:eol-style/svn:mime-type properties). It's just a guess, but FileNameMatcher seems to be the critical part. Hence, in addition to these patches it make sense to refactor fnmatch-API to provide another, much simpler matcher, if the pattern is actually no pattern, but a plain path.