diff options
author | Sven Strickroth <email@cs-ware.de> | 2013-03-07 22:15:40 +0100 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-03-25 14:03:16 -0700 |
commit | b8acb775e25c76f07dac8855ad0a88b37f7b2f17 (patch) | |
tree | f7e8d173813745f2a56c6078897fb9aeb9cad479 /tests-clar/diff/tree.c | |
parent | 9733e80c2ae7517f44c658cd2914d99454470dd1 (diff) | |
download | libgit2-b8acb775e25c76f07dac8855ad0a88b37f7b2f17.tar.gz |
Added some tests for issue #1397
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'tests-clar/diff/tree.c')
-rw-r--r-- | tests-clar/diff/tree.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests-clar/diff/tree.c b/tests-clar/diff/tree.c index e86f8d538..06e649979 100644 --- a/tests-clar/diff/tree.c +++ b/tests-clar/diff/tree.c @@ -431,3 +431,28 @@ void test_diff_tree__regular_blob_mode_changed_to_executable_file(void) cl_assert_equal_i(0, expect.file_status[GIT_DELTA_ADDED]); cl_assert_equal_i(0, expect.file_status[GIT_DELTA_TYPECHANGE]); } + +void test_diff_tree__issue_1397(void) +{ + // this test shows, that it is not needed + git_config *cfg; + g_repo = cl_git_sandbox_init("issue_1397"); + + cl_git_pass(git_repository_config(&cfg, g_repo)); + cl_git_pass(git_config_set_bool(cfg, "core.autocrlf", true)); + git_config_free(cfg); + + cl_assert((a = resolve_commit_oid_to_tree(g_repo, "8a7ef04")) != NULL); + cl_assert((b = resolve_commit_oid_to_tree(g_repo, "7f483a7")) != NULL); + + cl_git_pass(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts)); + + cl_git_pass(git_diff_foreach( + diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &expect)); + + cl_assert_equal_i(1, expect.files); + cl_assert_equal_i(0, expect.file_status[GIT_DELTA_DELETED]); + cl_assert_equal_i(1, expect.file_status[GIT_DELTA_MODIFIED]); + cl_assert_equal_i(0, expect.file_status[GIT_DELTA_ADDED]); + cl_assert_equal_i(0, expect.file_status[GIT_DELTA_TYPECHANGE]); +} |