Commit ce54e77c by Edward Thomson Committed by GitHub

Merge pull request #3922 from pks-t/pks/diff-only-load-binaries-when-requested

patch_generate: only calculate binary diffs if requested
parents 40b08124 4b34f687
...@@ -349,6 +349,9 @@ static int diff_binary(git_patch_generated_output *output, git_patch_generated * ...@@ -349,6 +349,9 @@ 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;
/* Only load contents if the user actually wants to diff
* binary files. */
if (patch->base.diff_opts.flags & GIT_DIFF_SHOW_BINARY) {
/* Create the old->new delta (as the "new" side of the patch), /* Create the old->new delta (as the "new" side of the patch),
* and the new->old delta (as the "old" side) * and the new->old delta (as the "old" side)
*/ */
...@@ -363,6 +366,7 @@ static int diff_binary(git_patch_generated_output *output, git_patch_generated * ...@@ -363,6 +366,7 @@ static int diff_binary(git_patch_generated_output *output, git_patch_generated *
&binary.new_file.inflatedlen, &binary.new_file.inflatedlen,
old_data, old_len, new_data, new_len)) < 0) old_data, old_len, new_data, new_len)) < 0)
return error; 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),
......
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