Commit 3148efd2 by Patrick Steinhardt

tests: verify diff stats with renames in subdirectory

Until now, we didn't have any tests that verified that our format for
renames in subdirectories is correct. While our current behaviour is no
different than for renames that do not happen with a common prefix
shared between old and new file name, we intend to change the format to
instead match the format that upstream git uses.

Add a test case for this to document our current behaviour and to show
how the next commit will change that format.
parent 1621a37d
......@@ -210,6 +210,25 @@ void test_diff_stats__rename_and_modifiy(void)
git_buf_dispose(&buf);
}
void test_diff_stats__rename_in_subdirectory(void)
{
git_buf buf = GIT_BUF_INIT;
const char *stat =
" dir/orig.txt => dir/renamed.txt | 0\n"
" 1 file changed, 0 insertions(+), 0 deletions(-)\n";
diff_stats_from_commit_oid(
&_stats, "0db2a262bc8c5c3cba55254730045a8258da7a37", true);
cl_assert_equal_sz(1, git_diff_stats_files_changed(_stats));
cl_assert_equal_sz(0, git_diff_stats_insertions(_stats));
cl_assert_equal_sz(0, git_diff_stats_deletions(_stats));
cl_git_pass(git_diff_stats_to_buf(&buf, _stats, GIT_DIFF_STATS_FULL, 0));
cl_assert_equal_s(stat, git_buf_cstr(&buf));
git_buf_dispose(&buf);
}
void test_diff_stats__rename_no_find(void)
{
git_buf buf = GIT_BUF_INIT;
......
5219b9784f9a92d7bd7cb567a6d6a21bfb86697e
0db2a262bc8c5c3cba55254730045a8258da7a37
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment