dir.c: fix EXC_FLAG_MUSTBEDIR match in sparse checkout

Commit c84de70 (excluded_1(): support exclude files in index -
2009-08-20) tries to work around the fact that there is no
directory/file information in index entries, therefore
EXC_FLAG_MUSTBEDIR match would fail.

Unfortunately the workaround is flawed. This fixes it.

Reported-by: Thomas Rinderknecht <thomasr@sailguy.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2010-11-08 01:04:58 +07:00
committed by Junio C Hamano
parent af77aee9ca
commit ae3cdfe112
2 changed files with 9 additions and 4 deletions

3
dir.c
View File

@ -360,7 +360,8 @@ int excluded_from_list(const char *pathname,
if (x->flags & EXC_FLAG_MUSTBEDIR) {
if (!dtype) {
if (!prefixcmp(pathname, exclude))
if (!prefixcmp(pathname, exclude) &&
pathname[x->patternlen] == '/')
return to_exclude;
else
continue;