Commits

Anonymous committed 82881b3

gitattributes: Fix subdirectory attributes specified from root directory

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

  • Participants
  • Parent commits 29df238

Comments (0)

Files changed (2)

 	    (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)

File t/t0003-attributes.sh

 	mkdir -p a/b/d a/c &&
 	(
 		echo "f	test=f"
+		echo "a/i test=a/i"
 	) >.gitattributes &&
 	(
 		echo "g test=a/g" &&
 
 '
 
+test_expect_success 'root subdir attribute test' '
+
+	attr_check a/i a/i &&
+	attr_check subdir/a/i unspecified
+
+'
+
 test_done