Commit 245c5eae by nulltoken

diff: When diffing two blobs, ensure the delta callback parameter is filled with…

diff: When diffing two blobs, ensure the delta callback parameter is filled with relevant information
parent 8d0f4675
...@@ -728,12 +728,16 @@ int git_diff_blobs( ...@@ -728,12 +728,16 @@ int git_diff_blobs(
delta.status = old_data.ptr ? delta.status = old_data.ptr ?
(new_data.ptr ? GIT_DELTA_MODIFIED : GIT_DELTA_DELETED) : (new_data.ptr ? GIT_DELTA_MODIFIED : GIT_DELTA_DELETED) :
(new_data.ptr ? GIT_DELTA_ADDED : GIT_DELTA_UNTRACKED); (new_data.ptr ? GIT_DELTA_ADDED : GIT_DELTA_UNTRACKED);
delta.old_file.mode = 0100644; /* can't know the truth from a blob alone */ delta.old_file.mode = 0000000; /* can't know the truth from a blob alone */
delta.new_file.mode = 0100644; delta.new_file.mode = 0000000;
git_oid_cpy(&delta.old_file.oid, git_object_id((const git_object *)old_blob)); 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)); git_oid_cpy(&delta.new_file.oid, git_object_id((const git_object *)new_blob));
delta.old_file.path = NULL; delta.old_file.path = NULL;
delta.new_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; delta.similarity = 0;
info.diff = NULL; info.diff = NULL;
......
...@@ -13,7 +13,7 @@ void test_diff_blob__cleanup(void) ...@@ -13,7 +13,7 @@ void test_diff_blob__cleanup(void)
cl_git_sandbox_cleanup(); 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_blob *a, *b, *c, *d;
git_oid a_oid, b_oid, c_oid, d_oid; git_oid a_oid, b_oid, c_oid, d_oid;
......
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