mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x•ÎA
|
||||
Â0@Q×9Åì™f’6<11> z‚™tBCm-i¼¿â
üû?½–¥4°„‡VUÁS´š)Eóàœ„hET¤ëƒ|}BÊd6®º6Á<>Õ±=&§9Ø8KêÆ€<Æ<>¢dÃï6½*ܸՒfx4-ëÄulpÞöë6ï§²\ ózçˆ"Ñ"šôûkú¿4w]yQÈå©PVØß2–j>ÄTIð
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
5219b9784f9a92d7bd7cb567a6d6a21bfb86697e
|
||||
0db2a262bc8c5c3cba55254730045a8258da7a37
|
||||
|
||||
5
tests/resources/diff_format_email/dir/renamed.txt
Normal file
5
tests/resources/diff_format_email/dir/renamed.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
file2
|
||||
file2
|
||||
file2
|
||||
file2!
|
||||
file2
|
||||
Reference in New Issue
Block a user