diff options
author | Russell Belfer <rb@github.com> | 2014-04-18 14:42:40 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-18 14:42:40 -0700 |
commit | 916fcbd61754f74b350ca689e27563cdbded2d30 (patch) | |
tree | bb15608b4bde5f23660ae96c6b7cc30dc545d593 /tests | |
parent | e3a2a04ceff1d3657629fd6a7245d9a9fc53f24b (diff) | |
download | libgit2-916fcbd61754f74b350ca689e27563cdbded2d30.tar.gz |
Fix ignore difference from git with trailing /*
Ignore patterns that ended with a trailing '/*' were still needing
to match against another actual '/' character in the full path.
This is not the same behavior as core Git.
Instead, we strip a trailing '/*' off of any patterns that were
matching and just take it to imply the FNM_LEADING_DIR behavior.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/status/ignore.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/status/ignore.c b/tests/status/ignore.c index 15c85e262..d88b2eb6b 100644 --- a/tests/status/ignore.c +++ b/tests/status/ignore.c @@ -456,6 +456,24 @@ void test_status_ignore__contained_dir_with_matching_name(void) cl_assert_equal_i(0, counts.wrong_sorted_path); } +void test_status_ignore__trailing_slash_star(void) +{ + static const char *test_files[] = { + "empty_standard_repo/file", + "empty_standard_repo/subdir/file", + "empty_standard_repo/subdir/sub2/sub3/file", + NULL + }; + + make_test_data("empty_standard_repo", test_files); + cl_git_mkfile( + "empty_standard_repo/subdir/.gitignore", "/**/*\n"); + + refute_is_ignored("file"); + assert_is_ignored("subdir/sub2/sub3/file"); + assert_is_ignored("subdir/file"); +} + void test_status_ignore__adding_internal_ignores(void) { g_repo = cl_git_sandbox_init("empty_standard_repo"); |