diff options
author | Edward Thomson <ethomson@github.com> | 2016-08-17 08:54:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-17 08:54:48 -0500 |
commit | 635a922274046ee077235b9764d0360e33d735ab (patch) | |
tree | 6692f0f353856dcd840f86375cd4a5afd722df7a /tests | |
parent | 26a8617d96ba96875304d56a7ce698a85e559c43 (diff) | |
parent | fcb2c1c8956200f49263e6e0b3c681d100af4734 (diff) | |
download | libgit2-635a922274046ee077235b9764d0360e33d735ab.tar.gz |
Merge pull request #3895 from pks-t/pks/negate-basename-in-subdirs
ignore: allow unignoring basenames in subdirectories
Diffstat (limited to 'tests')
-rw-r--r-- | tests/status/ignore.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/status/ignore.c b/tests/status/ignore.c index c318046da..c4878b2dd 100644 --- a/tests/status/ignore.c +++ b/tests/status/ignore.c @@ -945,6 +945,44 @@ void test_status_ignore__negative_directory_ignores(void) assert_is_ignored("padded_parent/child8/bar.txt"); } +void test_status_ignore__unignore_entry_in_ignored_dir(void) +{ + static const char *test_files[] = { + "empty_standard_repo/bar.txt", + "empty_standard_repo/parent/bar.txt", + "empty_standard_repo/parent/child/bar.txt", + "empty_standard_repo/nested/parent/child/bar.txt", + NULL + }; + + make_test_data("empty_standard_repo", test_files); + cl_git_mkfile( + "empty_standard_repo/.gitignore", + "bar.txt\n" + "!parent/child/bar.txt\n"); + + assert_is_ignored("bar.txt"); + assert_is_ignored("parent/bar.txt"); + refute_is_ignored("parent/child/bar.txt"); + assert_is_ignored("nested/parent/child/bar.txt"); +} + +void test_status_ignore__do_not_unignore_basename_prefix(void) +{ + static const char *test_files[] = { + "empty_standard_repo/foo_bar.txt", + NULL + }; + + make_test_data("empty_standard_repo", test_files); + cl_git_mkfile( + "empty_standard_repo/.gitignore", + "foo_bar.txt\n" + "!bar.txt\n"); + + assert_is_ignored("foo_bar.txt"); +} + void test_status_ignore__filename_with_cr(void) { int ignored; |