* gitignore documentation for info/exclude files and patterns with relative directories
@ 2026-03-27 11:20 Dan Drake
2026-03-27 16:18 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Dan Drake @ 2026-03-27 11:20 UTC (permalink / raw)
To: git@vger.kernel.org
Hello,
In the "pattern format" section of the gitignore manpage, it says:
> The slash "/" is used as the directory separator. Separators may occur at the
> beginning, middle or end of the .gitignore search pattern.
>
> If there is a separator at the beginning or middle (or both) of the pattern,
> then the pattern is relative to the directory level of the particular
> .gitignore file itself. Otherwise the pattern may also match at any
> level below the .gitignore level.
For a .git/info/exclude file, the above makes it sound like the pattern will be
relative to that .git/info directory, so that you would need to use this kind of p
attern to match files starting with 'foo' in the root of the repo:
../../foo*
However, it seems that for patterns in the info/exclude file, the beginning
slash anchors the pattern to the root of the repo; the above pattern
in that file should be '/foo*'.
The documentation should mention this behavior for info/exclude, as well as
the core.excludesFile.
Dan
--
Ceci n'est pas une .signature.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gitignore documentation for info/exclude files and patterns with relative directories
2026-03-27 11:20 gitignore documentation for info/exclude files and patterns with relative directories Dan Drake
@ 2026-03-27 16:18 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2026-03-27 16:18 UTC (permalink / raw)
To: Dan Drake; +Cc: git@vger.kernel.org
Dan Drake <dan@dandrake.org> writes:
> The documentation should mention this behavior for info/exclude, as well as
> the core.excludesFile.
Yup, my mistake more than 20-year-old that nobody complained so far
;-)
Yes, these exclude pattern sources that are outside the working tree
behave as if they are specified at the root level of the working
tree.
Patches welcome. Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-27 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 11:20 gitignore documentation for info/exclude files and patterns with relative directories Dan Drake
2026-03-27 16:18 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox