Skip to content

Commit 1916490

Browse files
committed
ignore: test that leading whitespace is significant
Ensure that leading whitespace is treated as being part of the filename, eg ` foo` in an ignore file indicates that a file literally named ` foo` is ignored.
1 parent ac070af commit 1916490

File tree

2 files changed

+1294
-0
lines changed

2 files changed

+1294
-0
lines changed

tests/status/ignore.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,3 +1236,29 @@ void test_status_ignore__skips_bom(void)
12361236
refute_is_ignored("foo.txt");
12371237
refute_is_ignored("bar.txt");
12381238
}
1239+
1240+
void test_status_ignore__leading_spaces_are_significant(void)
1241+
{
1242+
static const char *test_files[] = {
1243+
"empty_standard_repo/a.test",
1244+
"empty_standard_repo/b.test",
1245+
"empty_standard_repo/c.test",
1246+
"empty_standard_repo/d.test",
1247+
NULL
1248+
};
1249+
1250+
make_test_data("empty_standard_repo", test_files);
1251+
cl_git_mkfile(
1252+
"empty_standard_repo/.gitignore",
1253+
" a.test\n"
1254+
"b.test\n"
1255+
"\tc.test\n"
1256+
"d.test\n");
1257+
1258+
refute_is_ignored("a.test");
1259+
assert_is_ignored(" a.test");
1260+
assert_is_ignored("b.test");
1261+
refute_is_ignored("c.test");
1262+
assert_is_ignored("\tc.test");
1263+
assert_is_ignored("d.test");
1264+
}

0 commit comments

Comments
 (0)