From c3c327deeaf018e727a27f5ae88e140ff7a48595 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Wed, 29 May 2013 22:32:36 +0200 Subject: dir.c: fix ignore processing within not-ignored directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of 95c6f271 "dir.c: unify is_excluded and is_path_excluded APIs", the is_excluded API no longer recurses into directories that match an ignore pattern, and returns the directory's ignored state for all contained paths. This is OK for normal ignore patterns, i.e. ignoring a directory affects the entire contents recursively. Unfortunately, this also "works" for negated ignore patterns ('!dir'), i.e. the entire contents is "not-ignored" recursively, regardless of ignore patterns that match the contents directly. In prep_exclude, skip recursing into a directory only if it is really ignored (i.e. the ignore pattern is not negated). Signed-off-by: Karsten Blees Tested-by: Øystein Walle Reviewed-by: Duy Nguyen Signed-off-by: Junio C Hamano --- dir.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dir.c') diff --git a/dir.c b/dir.c index a5926fbd1a..13858fefa5 100644 --- a/dir.c +++ b/dir.c @@ -821,6 +821,9 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen) dir->basebuf, stk->baselen - 1, dir->basebuf + current, &dt); dir->basebuf[stk->baselen - 1] = '/'; + if (dir->exclude && + dir->exclude->flags & EXC_FLAG_NEGATIVE) + dir->exclude = NULL; if (dir->exclude) { dir->basebuf[stk->baselen] = 0; dir->exclude_stack = stk; -- cgit v1.2.1