path: root/dir.c
diff options
authorNguyễn Thái Ngọc Duy <>2009-08-20 13:47:03 (GMT)
committerJunio C Hamano <>2009-08-24 00:13:33 (GMT)
commitc84de70781674a35b9bfd20aa5bc8c47582615df (patch)
tree9741747d2bddb1920925b94722c908adc3449817 /dir.c
parent32f54ca31747c47f56abb7ae87a6da0f5b8d97c3 (diff)
excluded_1(): support exclude files in index
Index does not really have "directories", attempts to match "foo/" against index will fail unless someone tries to reconstruct directories from a list of file. Observing that dtype in this function can never be NULL (otherwise it would segfault), dtype NULL will be used to say "hey.. you are matching against index" and behave properly. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'dir.c')
1 files changed, 6 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index e8e5b79..7735cea 100644
--- a/dir.c
+++ b/dir.c
@@ -349,6 +349,12 @@ static int excluded_1(const char *pathname,
int to_exclude = x->to_exclude;
if (x->flags & EXC_FLAG_MUSTBEDIR) {
+ if (!dtype) {
+ if (!prefixcmp(pathname, exclude))
+ return to_exclude;
+ else
+ continue;
+ }
if (*dtype == DT_UNKNOWN)
*dtype = get_dtype(NULL, pathname, pathlen);
if (*dtype != DT_DIR)