From: Johannes Sixt <j6t@kdbg.org>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Eric Blake <eblake@redhat.com>, git@vger.kernel.org
Subject: Re: [PATCH] Documentation: enhance gitignore whitelist example
Date: Tue, 5 Apr 2011 23:15:54 +0200 [thread overview]
Message-ID: <201104052315.54375.j6t@kdbg.org> (raw)
In-Reply-To: <20110405194005.GA32427@elie>
On Dienstag, 5. April 2011, Jonathan Nieder wrote:
> Eric Blake wrote:
> > @@ -70,7 +70,9 @@ PATTERN FORMAT
> > - An optional prefix '!' which negates the pattern; any
> > matching file excluded by a previous pattern will become
> > included again. If a negated pattern matches, this will
> > - override lower precedence patterns sources.
> > + override lower precedence patterns sources. However, a
> > + file negation does not override a path that has already
> > + been excluded by a directory match.
I don't think this is the right place to explain this caveat. Here we describe
the format and behavior of the patterns in a rather formal manner.
> > @@ -87,7 +89,8 @@ PATTERN FORMAT
> >
> > - 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.
> > + wildcards in the pattern will not match a / in the pathname,
> > + and do not ignore files with a leading . in the pathname.
I don't think this is correct. * matches .gitignore. I tried it.
> > @@ -116,8 +119,11 @@ EXAMPLES
> > [...]
> > # Untracked files:
> > [...]
> > + # Documentation/build
> > # Documentation/foo.html
> > # Documentation/gitignore.html
> > + # build/log
> > + # build/.file
> > # file.o
> > # lib.a
> > # src/internal.o
> > @@ -125,6 +131,10 @@ EXAMPLES
> > $ cat .git/info/exclude
> > # ignore objects and archives, anywhere in the tree.
> > *.[oa]
> > + # ignore files in the immediate child directory build,
> > + /build/*
> > + # except for the log.
> > + !/build/log
Doesn't this example give the false impression that you could do
/foo/*
!/foo/bar/baz
and have foo/bar/baz not ignored? But it is still ignored.
I propose a paragraph like this in the NOTES section:
--- 8< ---
When a directory is ignored, it is not possible to un-ignore a single file
somewhere in the directory using another pattern. E.g., with the patterns
--------------
/build/
!/build/tests/results
--------------
the file "build/tests/results" is still ignored because when a directory is
ignored, its contents are never investigated. In a situation where a few
exceptions in an otherwise ignored hierarchy are needed, the recommended
procedure is to specify to ignore the root of the hierarchy and then to 'git
add -f' the exceptional files. Subsequent changes to the files will not be
ignored.
--- 8< ---
-- Hannes
next prev parent reply other threads:[~2011-04-05 21:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 19:36 [PATCH] Documentation: enhance gitignore whitelist example Eric Blake
2011-04-05 19:40 ` Jonathan Nieder
2011-04-05 21:15 ` Johannes Sixt [this message]
2011-04-05 21:23 ` Eric Blake
2011-04-05 21:41 ` Jonathan Nieder
2011-04-05 21:49 ` Eric Blake
2011-04-05 21:51 ` Junio C Hamano
2011-04-05 21:39 ` Junio C Hamano
2011-04-05 20:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201104052315.54375.j6t@kdbg.org \
--to=j6t@kdbg.org \
--cc=eblake@redhat.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).