summaryrefslogtreecommitdiff
path: root/src/diff_patch.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-07-24 13:09:33 -0700
committerRussell Belfer <rb@github.com>2013-07-24 13:09:33 -0700
commit69c66b554e1072d8b6c63366834e15310fecaea7 (patch)
treedb263a017364251d615105c5bdea9451b756da95 /src/diff_patch.c
parent39a1a66242a480b880032f5a6a4e31ee77414d4c (diff)
downloadlibgit2-69c66b554e1072d8b6c63366834e15310fecaea7.tar.gz
Don't do text diff unless content will be used
Diffstat (limited to 'src/diff_patch.c')
-rw-r--r--src/diff_patch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/diff_patch.c b/src/diff_patch.c
index 1b4adac03..02a45cb1a 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -230,6 +230,10 @@ static int diff_patch_generate(git_diff_patch *patch, git_diff_output *output)
if ((patch->flags & GIT_DIFF_PATCH_DIFFED) != 0)
return 0;
+ /* if we are not looking at the hunks and lines, don't do the diff */
+ if (!output->hunk_cb && !output->data_cb)
+ return 0;
+
if ((patch->flags & GIT_DIFF_PATCH_LOADED) == 0 &&
(error = diff_patch_load(patch, output)) < 0)
return error;