diff options
author | Erik van Zijst <erik.van.zijst@gmail.com> | 2018-04-04 21:28:31 -0700 |
---|---|---|
committer | Erik van Zijst <erik.van.zijst@gmail.com> | 2018-04-05 13:15:36 -0700 |
commit | bc5ced66308e69f12dab364e110fe2a5d1a8da8a (patch) | |
tree | e31923e02b3e8c78c77998b460221c8d0887b68c /tests/checkout | |
parent | d9007dc8520942763a21e4058dfa8f159f3e3c56 (diff) | |
download | libgit2-bc5ced66308e69f12dab364e110fe2a5d1a8da8a.tar.gz |
diff: Add missing GIT_DELTA_TYPECHANGE -> 'T' mapping.
This adds the 'T' status character to git_diff_status_char() for diff
entries that change type.
Diffstat (limited to 'tests/checkout')
-rw-r--r-- | tests/checkout/typechange.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c index 8a5110caa..647b534b1 100644 --- a/tests/checkout/typechange.c +++ b/tests/checkout/typechange.c @@ -1,4 +1,5 @@ #include "clar_libgit2.h" +#include "diff_generate.h" #include "git2/checkout.h" #include "path.h" #include "posix.h" @@ -307,3 +308,28 @@ void test_checkout_typechange__checkout_with_conflicts(void) git_object_free(obj); } } + +void test_checkout_typechange__status_char(void) +{ + size_t i; + git_oid oid; + git_commit *commit; + git_diff *diff; + const git_diff_delta *delta; + git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT; + char expected[8] = {'M', 'M', 'R', 'T', 'D', 'R', 'A', 'R'}; + + git_oid_fromstr(&oid, "9b19edf33a03a0c59cdfc113bfa5c06179bf9b1a"); + cl_git_pass(git_commit_lookup(&commit, g_repo, &oid)); + diffopts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE; + cl_git_pass(git_diff__commit(&diff, g_repo, commit, &diffopts)); + cl_git_pass(git_diff_find_similar(diff, NULL)); + + for (i = 0; i < git_diff_num_deltas(diff); i++) { + delta = git_diff_get_delta(diff, i); + cl_assert_equal_i(expected[i], git_diff_status_char(delta->status)); + } + + git_diff_free(diff); + git_commit_free(commit); +} |