mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-10 18:28:16 +00:00
diff: When diffing two blobs, ensure the delta callback parameter is filled with relevant information
This commit is contained in:
parent
8d0f46754f
commit
245c5eaec5
@ -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)
|
|||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user