Skip to content

Commit b635ed9

Browse files
peffgitster
authored andcommitted
doc/gitattributes: mention non-recursive behavior
The gitattributes documentation claims that the pattern rules are largely the same as for gitignore. However, the rules for recursion are different. In an ideal world, we would make them the same (if for nothing else than consistency and simplicity), but that would create backwards compatibility issues. For some discussion, see this thread: https://public-inbox.org/git/[email protected]/ But let's at least document the differences instead of actively misleading the user by claiming that they're the same. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38e79b1 commit b635ed9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Documentation/gitattributes.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ Unspecified::
5656

5757
When more than one pattern matches the path, a later line
5858
overrides an earlier line. This overriding is done per
59-
attribute. The rules how the pattern matches paths are the
60-
same as in `.gitignore` files; see linkgit:gitignore[5].
61-
Unlike `.gitignore`, negative patterns are forbidden.
59+
attribute.
60+
61+
The rules by which the pattern matches paths are the same as in
62+
`.gitignore` files (see linkgit:gitignore[5]), with a few exceptions:
63+
64+
- negative patterns are forbidden
65+
66+
- patterns that match a directory do not recursively match paths
67+
inside that directory (so using the trailing-slash `path/` syntax is
68+
pointless in an attributes file; use `path/**` instead)
6269

6370
When deciding what attributes are assigned to a path, Git
6471
consults `$GIT_DIR/info/attributes` file (which has the highest

0 commit comments

Comments
 (0)