diff.c: fix emit_line() again not to add extra line
[gitweb.git] / attr.c
diff --git a/attr.c b/attr.c
index 64b77b16636482d3448027d7823e5dc07861faa5..1a15fad294c5db1f922e686995e215b94b89b9a0 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -546,7 +546,9 @@ static int path_matches(const char *pathname, int pathlen,
            (baselen && pathname[baselen] != '/') ||
            strncmp(pathname, base, baselen))
                return 0;
-       return fnmatch(pattern, pathname + baselen + 1, FNM_PATHNAME) == 0;
+       if (baselen != 0)
+               baselen++;
+       return fnmatch(pattern, pathname + baselen, FNM_PATHNAME) == 0;
 }
 
 static int fill_one(const char *what, struct match_attr *a, int rem)