Re: Wrong gitattributes documentation?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 3, 2017, 00:01 UTC
- Message-ID
- <xmqq8tlax7lm.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <e7734a23-12b2-8f62-ab5c-c856d59e3010@pasing.net>
Rene Pasing <rene@pasing.net> writes:
Show 8 quoted lines
> The problem is, the documentation[1] says: "The rules how the pattern > matches paths are the same as in .gitignore files; see gitignore[5].", > so when I have a pattern like '/images/', it should match on all > files+folders under /images, even the directory itself, right? > > Or when > I'd use '/images/*', it should match on all files+folders under > /images, right?
My reading of "PATTERN FORMAT" section in "git help ignore" says it shouldn't.
- 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).
- Otherwise, Git treats the pattern as a shell glob suitable
for consumption by fnmatch(3) with the FNM_PATHNAME flag:
wildcards in the pattern will not match a / in the pathname.
For example, "Documentation/{asterisk}.html" matches
"Documentation/git.html" but not "Documentation/ppc/ppc.html"
or "tools/perf/Documentation/perf.html".Your "/images/*" is the "Otherwise" case, isn't it?