git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] test overlapping ignore patterns

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Dec 18, 2008, 17:11 UTC
Message-ID
<1229620278-25152-1-git-send-email-git@drmicha.warpmail.net>
In-Reply-To
<7viqpjra57.fsf@gitster.siamese.dyndns.org>

Add a test which checks that negated patterns such as "!foo.html" can override previous patterns such as "*.html". This is documented behaviour but had not been tested so far.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/t3001-ls-files-others-exclude.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index 8666946..85aef12 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -140,4 +140,10 @@ test_expect_success 'trailing slash in exclude forces directory match (2)' '
 
 '
 
+test_expect_success 'negated exclude matches can override previous ones' '
+
+	git ls-files --others --exclude="a.*" --exclude="!a.1" >output &&
+	grep "^a.1" output
+'
+
 test_done
-- 
1.6.1.rc1
Previous: Junio C HamanoNext: Stephen Haberman
Message 4 of 7 in “git ignore”
  1. Max PowerDec 16, 2008
  2. Linus TorvaldsDec 16, 2008
  3. Junio C HamanoDec 16, 2008
  4. test overlapping ignore patternsMichael J Gruber, Dec 18, 2008
  5. Stephen HabermanJul 7, 2011
  6. Junio C HamanoJul 8, 2011
  7. Stephen HabermanJul 8, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.