summaryrefslogtreecommitdiff
path: root/tests-clar
diff options
context:
space:
mode:
authoryorah <yoram.harmelin@gmail.com>2013-04-11 17:29:05 +0200
committeryorah <yoram.harmelin@gmail.com>2013-04-15 16:39:56 +0200
commit2e40a60e847d6c128af23e24ea7a8efebd2427da (patch)
tree398dabc6825bc63f578d39069a7a097f705bbf15 /tests-clar
parent2d2260da41ddf22fd5c5f0c39ce16fad1548f29e (diff)
downloadlibgit2-2e40a60e847d6c128af23e24ea7a8efebd2427da.tar.gz
status: fix handling of filenames with special prefixes
Fix libgit2/libgit2sharp#379
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/status/ignore.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests-clar/status/ignore.c b/tests-clar/status/ignore.c
index 2d3898ba4..6c17d2c39 100644
--- a/tests-clar/status/ignore.c
+++ b/tests-clar/status/ignore.c
@@ -459,3 +459,37 @@ void test_status_ignore__automatically_ignore_bad_files(void)
cl_git_pass(git_status_should_ignore(&ignored, g_repo, "path/whatever.c"));
cl_assert(!ignored);
}
+
+void test_status_ignore__filenames_with_special_prefixes_do_not_interfere_with_status_retrieval(void)
+{
+ status_entry_single st;
+ char *test_cases[] = {
+ "!file",
+ "#blah",
+ "[blah]",
+ "[attr]",
+ "[attr]blah",
+ NULL
+ };
+ int i;
+
+ for (i = 0; *(test_cases + i) != NULL; i++) {
+ git_buf file = GIT_BUF_INIT;
+ char *file_name = *(test_cases + i);
+ git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
+
+ cl_git_pass(git_buf_joinpath(&file, "empty_standard_repo", file_name));
+ cl_git_mkfile(git_buf_cstr(&file), "Please don't ignore me!");
+
+ memset(&st, 0, sizeof(st));
+ cl_git_pass(git_status_foreach(repo, cb_status__single, &st));
+ cl_assert(st.count == 1);
+ cl_assert(st.status == GIT_STATUS_WT_NEW);
+
+ cl_git_pass(git_status_file(&st.status, repo, file_name));
+ cl_assert(st.status == GIT_STATUS_WT_NEW);
+
+ cl_git_sandbox_cleanup();
+ git_buf_free(&file);
+ }
+}