mirror of
https://git.proxmox.com/git/libgit2
synced 2025-11-03 16:29:14 +00:00
diff: only compute patches when requested
When we're called with no hunk or line callback, we don't need to do the hunk or line computation.
This commit is contained in:
parent
d5712ed2b3
commit
147d86fc69
@ -284,11 +284,12 @@ int git_diff_foreach(
|
||||
if (git_diff_delta__should_skip(&diff->opts, patch.delta))
|
||||
continue;
|
||||
|
||||
if ((error = diff_patch_init_from_diff(&patch, diff, idx)) < 0)
|
||||
break;
|
||||
|
||||
if (!(error = diff_patch_invoke_file_callback(&patch, &xo.output)))
|
||||
error = diff_patch_generate(&patch, &xo.output);
|
||||
if ((error = diff_patch_invoke_file_callback(&patch, &xo.output)) == 0) {
|
||||
if (hunk_cb || data_cb) {
|
||||
if ((error = diff_patch_init_from_diff(&patch, diff, idx)) == 0)
|
||||
error = diff_patch_generate(&patch, &xo.output);
|
||||
}
|
||||
}
|
||||
|
||||
git_patch_free(&patch);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user