From 69c66b554e1072d8b6c63366834e15310fecaea7 Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Wed, 24 Jul 2013 13:09:33 -0700 Subject: [PATCH] Don't do text diff unless content will be used --- src/diff_patch.c | 4 ++++ 1 file changed, 4 insertions(+) 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;