Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> writes: > 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@xxxxxxxxxxx> > Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> > --- Hmmm... > diff --git a/dir.c b/dir.c > index d1e5e5e..b2dfb69 100644 > --- a/dir.c > +++ b/dir.c > @@ -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] == '/') - Can pathname be much shorter than x->patternlen (it doesn't matter as prefixcmp will return false in that case)? - Can pathname be equal to exclude (yes it can but in that case pathname is not a directory but is a regular file, symlink or a submodule)? So it may be a tricky code, but I do not think it is a "workaround" in any way. Isn't it just a "correct solution"? By the way, builtin/add.c calls excluded() with DT_UNKNOWN and relies on the fact that the macro is accidentally defined as 0. 108da0d (git add: Add the "--ignore-missing" option for the dry run, 2010-07-10). If it means NULL, it should spell it out as such. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html