diff-tree: don't match non-directories as partial pathnames
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 18 May 2005 21:17:22 +0000 (14:17 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 18 May 2005 21:17:22 +0000 (14:17 -0700)
This normally doesn't matter, but if you have a filename that is
sometimes a directory and sometimes a regular file (or symlink),
we don't want the regular file case to trigger a "partial match".

diff-tree.c

index 8fb5729363e4d85ff0a88173f05140bab43aa42f..59d12f2ba1325bad77dd062936c20cd9cc4d602f 100644 (file)
@@ -204,6 +204,8 @@ static int interesting(void *tree, unsigned long size, const char *base)
                if (matchlen > pathlen) {
                        if (match[pathlen] != '/')
                                continue;
+                       if (!S_ISDIR(mode))
+                               continue;
                }
 
                if (strncmp(path, match, pathlen))