mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 20:13:24 +00:00
Merge pull request #3922 from pks-t/pks/diff-only-load-binaries-when-requested
patch_generate: only calculate binary diffs if requested
This commit is contained in:
commit
ce54e77c70
@ -349,20 +349,24 @@ static int diff_binary(git_patch_generated_output *output, git_patch_generated *
|
|||||||
new_len = patch->nfile.map.len;
|
new_len = patch->nfile.map.len;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Create the old->new delta (as the "new" side of the patch),
|
/* Only load contents if the user actually wants to diff
|
||||||
* and the new->old delta (as the "old" side)
|
* binary files. */
|
||||||
*/
|
if (patch->base.diff_opts.flags & GIT_DIFF_SHOW_BINARY) {
|
||||||
if ((error = create_binary(&binary.old_file.type,
|
/* Create the old->new delta (as the "new" side of the patch),
|
||||||
(char **)&binary.old_file.data,
|
* and the new->old delta (as the "old" side)
|
||||||
&binary.old_file.datalen,
|
*/
|
||||||
&binary.old_file.inflatedlen,
|
if ((error = create_binary(&binary.old_file.type,
|
||||||
new_data, new_len, old_data, old_len)) < 0 ||
|
(char **)&binary.old_file.data,
|
||||||
(error = create_binary(&binary.new_file.type,
|
&binary.old_file.datalen,
|
||||||
(char **)&binary.new_file.data,
|
&binary.old_file.inflatedlen,
|
||||||
&binary.new_file.datalen,
|
new_data, new_len, old_data, old_len)) < 0 ||
|
||||||
&binary.new_file.inflatedlen,
|
(error = create_binary(&binary.new_file.type,
|
||||||
old_data, old_len, new_data, new_len)) < 0)
|
(char **)&binary.new_file.data,
|
||||||
return error;
|
&binary.new_file.datalen,
|
||||||
|
&binary.new_file.inflatedlen,
|
||||||
|
old_data, old_len, new_data, new_len)) < 0)
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
error = giterr_set_after_callback_function(
|
error = giterr_set_after_callback_function(
|
||||||
output->binary_cb(patch->base.delta, &binary, output->payload),
|
output->binary_cb(patch->base.delta, &binary, output->payload),
|
||||||
|
Loading…
Reference in New Issue
Block a user