diff options
author | Edward Thomson <ethomson@microsoft.com> | 2013-05-31 18:12:49 -0500 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-06-17 10:03:49 -0700 |
commit | 1540b19990fa5c566d607785c7b3651756e706ff (patch) | |
tree | 667cb2267578b95d60c6018f6ee85581147acf70 /tests-clar/diff/rename.c | |
parent | 351888cf3dc3c3525faccb010adcf5c130ac5b16 (diff) | |
download | libgit2-1540b19990fa5c566d607785c7b3651756e706ff.tar.gz |
some simple case-sensitive index tests
Diffstat (limited to 'tests-clar/diff/rename.c')
-rw-r--r-- | tests-clar/diff/rename.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests-clar/diff/rename.c b/tests-clar/diff/rename.c index 224945e60..6227a54e8 100644 --- a/tests-clar/diff/rename.c +++ b/tests-clar/diff/rename.c @@ -906,3 +906,35 @@ void test_diff_rename__rejected_match_can_match_others(void) git_buf_free(&one); git_buf_free(&two); } + +void test_diff_rename__case_changes_are_split(void) +{ + git_index *index; + git_tree *tree; + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; + git_diff_list *diff = NULL; + diff_expects exp; + + cl_git_pass(git_repository_index(&index, g_repo)); + + cl_git_pass( + git_revparse_single((git_object **)&tree, g_repo, "HEAD^{tree}")); + + cl_git_pass(p_rename("renames/ikeepsix.txt", "renames/IKEEPSIX.txt")); + + cl_git_pass(git_index_remove_bypath(index, "ikeepsix.txt")); + cl_git_pass(git_index_add_bypath(index, "IKEEPSIX.txt")); + cl_git_pass(git_index_write(index)); + + cl_git_pass(git_diff_tree_to_index(&diff, g_repo, tree, index, NULL)); + + memset(&exp, 0, sizeof(exp)); + cl_git_pass(git_diff_foreach( + diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp)); + cl_assert_equal_i(2, exp.files); + cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]); + cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]); + + git_index_free(index); +} + |