diff options
author | yorah <yoram.harmelin@gmail.com> | 2012-07-18 16:26:11 +0200 |
---|---|---|
committer | yorah <yoram.harmelin@gmail.com> | 2012-07-24 14:03:08 +0200 |
commit | e5e71f5e1db75075a81881f38b4ee0013fa966be (patch) | |
tree | d1204989e306a3fae93abb875c61db756ed1ab6b | |
parent | 151446ca605686b83b93952e8168cfc0b37cf4d3 (diff) | |
download | libgit2-e5e71f5e1db75075a81881f38b4ee0013fa966be.tar.gz |
Add more test coverage to match default git behavior for files containing brackets
-rw-r--r-- | tests-clar/status/worktree.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index a92d076e9..1bdd8160a 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -523,8 +523,10 @@ void test_status_worktree__bracket_in_filename(void) git_index *index; status_entry_single result; unsigned int status_flags; + int error; #define FILE_WITH_BRACKET "LICENSE[1].md" + #define FILE_WITHOUT_BRACKET "LICENSE1.md" cl_git_pass(git_repository_init(&repo, "with_bracket", 0)); cl_git_mkfile("with_bracket/" FILE_WITH_BRACKET, "I have a bracket in my name\n"); @@ -536,7 +538,7 @@ void test_status_worktree__bracket_in_filename(void) cl_assert_equal_i(1, result.count); cl_assert(result.status == GIT_STATUS_WT_NEW); - cl_git_pass(git_status_file(&status_flags, repo, "LICENSE[1].md")); + cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_BRACKET)); cl_assert(status_flags == GIT_STATUS_WT_NEW); /* ignore the file */ @@ -577,6 +579,20 @@ void test_status_worktree__bracket_in_filename(void) cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_BRACKET)); cl_assert(status_flags == GIT_STATUS_INDEX_NEW); + /* Create file without bracket */ + + cl_git_mkfile("with_bracket/" FILE_WITHOUT_BRACKET, "I have no bracket in my name!\n"); + + cl_git_pass(git_status_file(&status_flags, repo, FILE_WITHOUT_BRACKET)); + cl_assert(status_flags == GIT_STATUS_WT_NEW); + + cl_git_pass(git_status_file(&status_flags, repo, "LICENSE\\[1\\].md")); + cl_assert(status_flags == GIT_STATUS_INDEX_NEW); + + error = git_status_file(&status_flags, repo, FILE_WITH_BRACKET); + cl_git_fail(error); + cl_assert(error == GIT_EAMBIGUOUS); + git_index_free(index); git_repository_free(repo); } |