From: Nguyễn Thái Ngọc Duy Date: Thu, 20 Aug 2009 13:47:03 GMT Subject: [RFC PATCH v4 09/19] excluded_1(): support exclude files in index Message-ID: <1250776033-12395-10-git-send-email-pclouds@gmail.com> In-Reply-To: <1250776033-12395-9-git-send-email-pclouds@gmail.com> 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 --- dir.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/dir.c b/dir.c index cda2556..a4a91d5 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) -- 1.6.3.GIT