git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] t3700: note a .gitignore matching fault
@ 2011-05-02 12:47 Nguyễn Thái Ngọc Duy
  2011-05-02 12:47 ` [PATCH 2/3] t1011: fix sparse-checkout initialization and add new file Nguyễn Thái Ngọc Duy
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2011-05-02 12:47 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: skillzero, Nguyễn Thái Ngọc Duy

.gitignore support both positive and negative patterns. One may negate
the other. Current code works well if both patterns target files in
the same directory.

When a pattern targets a directory and an opposite pattern targets
some files/directories within that directory, we need to descend in
the directory until we're clear which ones are matched and which are
not.

excluded_from_list() (or its callers) fails to handle this case. It
too eagerly decides the fate of the whole directory without looking
further in.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Haven't figured out how to cleanly fix this yet, unfortunately.

 t/t3700-add.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 7de42fa..6c3eed6 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -295,4 +295,20 @@ test_expect_success C_LOCALE_OUTPUT 'git add --dry-run --ignore-missing of non-e
 	test_cmp expect.err actual.err
 '
 
+cat >expected <<EOF
+add 'test/.gitignore'
+add 'test/out/in'
+EOF
+
+test_expect_failure C_LOCALE_OUTPUT '' '
+	mkdir -p test/out &&
+	touch test/out/in test/out/out &&
+	cat >test/.gitignore <<EOF &&
+out
+!out/in
+EOF
+	git add --dry-run test >actual &&
+	test_cmp expected actual
+'
+
 test_done
-- 
1.7.4.74.g639db

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

end of thread, other threads:[~2011-05-11 16:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-02 12:47 [PATCH 1/3] t3700: note a .gitignore matching fault Nguyễn Thái Ngọc Duy
2011-05-02 12:47 ` [PATCH 2/3] t1011: fix sparse-checkout initialization and add new file Nguyễn Thái Ngọc Duy
2011-05-02 12:47 ` [PATCH 3/3] sparse checkout: do not eagerly decide the fate for whole directory Nguyễn Thái Ngọc Duy
2011-05-03  2:14   ` Thiago Farina
2011-05-03  4:43     ` Nguyen Thai Ngoc Duy
2011-05-10 23:37       ` Junio C Hamano
2011-05-11 12:03         ` Nguyen Thai Ngoc Duy
     [not found]     ` <1304955781-13566-1-git-send-email-pclouds@gmail.com>
2011-05-09 22:22       ` Junio C Hamano
2011-05-02 12:55 ` [PATCH 1/3] t3700: note a .gitignore matching fault Nguyễn Thái Ngọc Duy
2011-05-02 15:01   ` Johannes Sixt
2011-05-02 15:52     ` Nguyen Thai Ngoc Duy
2011-05-03 17:56       ` Junio C Hamano
2011-05-03 23:43         ` Nguyen Thai Ngoc Duy
2011-05-03 23:57           ` Junio C Hamano
2011-05-04  0:41             ` Nguyen Thai Ngoc Duy
2011-05-04  1:05               ` Nguyen Thai Ngoc Duy
2011-05-04  6:06                 ` Johannes Sixt
2011-05-04  6:22                   ` Nguyen Thai Ngoc Duy

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