提交 82881b38 编写于 作者: M Matthew Ogilvie 提交者: Junio C Hamano

gitattributes: Fix subdirectory attributes specified from root directory

Signed-off-by: NMatthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 29df2385
......@@ -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)
......
......@@ -21,6 +21,7 @@ test_expect_success 'setup' '
mkdir -p a/b/d a/c &&
(
echo "f test=f"
echo "a/i test=a/i"
) >.gitattributes &&
(
echo "g test=a/g" &&
......@@ -46,4 +47,11 @@ test_expect_success 'attribute test' '
'
test_expect_success 'root subdir attribute test' '
attr_check a/i a/i &&
attr_check subdir/a/i unspecified
'
test_done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册