git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gitignore: negating path patterns
@ 2008-05-21 14:52 Michael J Gruber
  2008-05-23  0:23 ` Kevin Ballard
  0 siblings, 1 reply; 6+ messages in thread
From: Michael J Gruber @ 2008-05-21 14:52 UTC (permalink / raw)
  To: git

Hi there

It seems that negating path patterns in gitignore doesn't work, or I
don't understand it (or both). With the attached script, git status
(1.5.5.1) reports "dir/a" as new and "dir/b" as untracked. I would
rather expect it to report "dir/c" as untracked also.

It seems that "!b" matches to include "dir/b" (reverting the exclusion
"*" as expected), whereas "!dir/" does not match to include "dir/c".

What's going on here?

Michael

P.S.: "*" in dir/.gitignore would do what I want, but I want all
patterns in one place.

P.P.S.: My first attempt at sending this was blocked (by an MS CDO for 
Exchange 2000?! Is this gmane playing pranks on me?). So I'll resend 
with the script inline rather than attached.

---etest.sh---


#!/bin/sh
rm -Rf test
mkdir test
cd test
git init
mkdir dir
echo test > a
echo test > dir/a
echo test > dir/b
echo test > dir/c
git add dir/a
cat > .git/info/exclude <<EOF
*
!dir/
!b
EOF
git status

^ permalink raw reply	[flat|nested] 6+ messages in thread
* gitignore: negating path patterns
@ 2008-05-21 14:40 Michael J Gruber
  0 siblings, 0 replies; 6+ messages in thread
From: Michael J Gruber @ 2008-05-21 14:40 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Hi there

It seems that negating path patterns in gitignore doesn't work, or I 
don't understand it (or both). With the attached script, git status 
(1.5.5.1) reports "dir/a" as new and "dir/b" as untracked. I would 
rather expect it to report "dir/c" as untracked also.

It seems that "!b" matches to include "dir/b" (reverting the exclusion 
"*" as expected), whereas "!dir/" does not match to include "dir/c".

What's going on here?

Michael

P.S.: "*" in dir/.gitignore would do what I want, but I want all 
patterns in one place.

[-- Attachment #2: etest.sh --]
[-- Type: application/x-shellscript, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-26  8:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 14:52 gitignore: negating path patterns Michael J Gruber
2008-05-23  0:23 ` Kevin Ballard
2008-05-23  7:52   ` Michael J Gruber
2008-05-23 22:44     ` Kevin Ballard
2008-05-26  8:54       ` Michael J Gruber
  -- strict thread matches above, loose matches on Subject: below --
2008-05-21 14:40 Michael J Gruber

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).