Subject: [PATCH 2/5] match_pathspec_depth: support negative pathspec

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Thu, 10 Mar 2011 10:13:36 +0700

The return value of this function is bugging me, as well as seen[]
array. Not really sure how to do with them when a negative pathspec is
matched.

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 dir.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dir.c b/dir.c
index 168dad6..75c4a8f 100644
--- a/dir.c
+++ b/dir.c
@@ -279,6 +279,11 @@ int match_pathspec_depth(const struct pathspec *ps,
 				how = 0;
 		}
 		if (how) {
+			if (ps->items[i].to_exclude) {
+				if (seen && seen[i] < how)
+					seen[i] = how;
+				return 0;
+			}
 			if (retval < how)
 				retval = how;
 			if (seen && seen[i] < how)
-- 
1.7.3.1.256.g2539c.dirty