>From afa6ef0ee1a299aef486367792f6dcc6e4e686d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 13 Oct 2010 19:10:35 +0700 Subject: [PATCH 2/3] Set EXC_FLAG_STARSTAR if a pattern starts with "**/" --- dir.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dir.c b/dir.c index 56974e5..241fbce 100644 --- a/dir.c +++ b/dir.c @@ -171,6 +171,10 @@ void add_exclude(const char *string, const char *base, to_exclude = 0; string++; } + if (*string == '*' && string[1] == '*' && string[2] == '/') { + flags |= EXC_FLAG_STARSTAR; + string += 3; + } len = strlen(string); if (len && string[len - 1] == '/') { char *s; @@ -180,7 +184,7 @@ void add_exclude(const char *string, const char *base, s[len - 1] = '\0'; string = s; x->pattern = s; - flags = EXC_FLAG_MUSTBEDIR; + flags |= EXC_FLAG_MUSTBEDIR; } else { x = xmalloc(sizeof(*x)); x->pattern = string; @@ -190,7 +194,7 @@ void add_exclude(const char *string, const char *base, x->base = base; x->baselen = baselen; x->flags = flags; - if (!strchr(string, '/')) + if (!(x->flags & EXC_FLAG_STARSTAR) && !strchr(string, '/')) x->flags |= EXC_FLAG_NODIR; if (no_wildcard(string)) x->flags |= EXC_FLAG_NOWILDCARD; -- 1.7.0.2.445.gcbdb3