clarify documentation of leading "**" in gitignore(5) man page

From: David Prager Branner <hidden>
Date: 2017-10-27 14:51:21

I've long been confused by something in the man page for gitignore. I think it's unclear and I'd like to propose a change. The passage is this (source at https://git.kernel.org/pub/scm/git/git-manpages.git/tree/man5/gitignore.5):
Two consecutive asterisks ("**") in patterns matched against full
pathname may have special meaning:

o   A leading "**" followed by a slash means match in all directories.
    For example, "**/foo" matches file or directory "foo" anywhere, the
    same as pattern "foo". "**/foo/bar" matches file or directory "bar"
    anywhere that is directly under directory "foo".

...
In the first paragraph, it would be clearer to specify:
Two consecutive asterisks ("**"), in patterns matched against a full
pathname, are a wildcard representing some arbitrary number of nested
directories within that pathname:
In the second paragraph, I suggest removing the first pattern, "**/foo", since it is completely redundant. There are no circumstances when "**/foo" is necessary in place of plain "foo", and its presence muddies discussion.

Leading "**" may represent nested directories in a pathname, but is useful only before a _pattern_ containing nested directories. I suggest making that explicit. Here is how I propose to rewrite it:
o   A leading "**", followed by a slash and a pattern containing nested
    directories, means match that pattern in all pathnames.
    For example, "**/foo/bar" matches file or directory "bar"
    anywhere that is directly under directory "foo". It would match
    "foo/bar", "other/foo/bar", "src/foo/bar/scram/gravy".
Thanks.

- dpb
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help