diff: When diffing two blobs, ensure the delta callback parameter is filled with relevant information
diff --git a/src/diff_output.c b/src/diff_output.c
index 4eefbf2..788c8b8 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -728,12 +728,16 @@ int git_diff_blobs(
delta.status = old_data.ptr ?
(new_data.ptr ? GIT_DELTA_MODIFIED : GIT_DELTA_DELETED) :
(new_data.ptr ? GIT_DELTA_ADDED : GIT_DELTA_UNTRACKED);
- delta.old_file.mode = 0100644; /* can't know the truth from a blob alone */
- delta.new_file.mode = 0100644;
+ delta.old_file.mode = 0000000; /* can't know the truth from a blob alone */
+ delta.new_file.mode = 0000000;
git_oid_cpy(&delta.old_file.oid, git_object_id((const git_object *)old_blob));
git_oid_cpy(&delta.new_file.oid, git_object_id((const git_object *)new_blob));
delta.old_file.path = NULL;
delta.new_file.path = NULL;
+ delta.old_file.size = old_data.size;
+ delta.new_file.size = new_data.size;
+ delta.old_file.flags = 0;
+ delta.new_file.flags = 0;
delta.similarity = 0;
info.diff = NULL;
diff --git a/tests-clar/diff/blob.c b/tests-clar/diff/blob.c
index ed1f14a..65b3500 100644
--- a/tests-clar/diff/blob.c
+++ b/tests-clar/diff/blob.c
@@ -13,7 +13,7 @@ void test_diff_blob__cleanup(void)
cl_git_sandbox_cleanup();
}
-void test_diff_blob__0(void)
+void test_diff_blob__can_compare_text_blobs(void)
{
git_blob *a, *b, *c, *d;
git_oid a_oid, b_oid, c_oid, d_oid;