summaryrefslogtreecommitdiff
path: root/src/diff_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/diff_output.c')
-rw-r--r--src/diff_output.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/diff_output.c b/src/diff_output.c
index dadbe284f..9c8e07972 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -747,6 +747,10 @@ int git_diff_blobs(
delta.status = new ?
(old ? GIT_DELTA_MODIFIED : GIT_DELTA_ADDED) :
(old ? GIT_DELTA_DELETED : GIT_DELTA_UNTRACKED);
+
+ if (git_oid_cmp(&delta.new_file.oid, &delta.old_file.oid) == 0)
+ delta.status = GIT_DELTA_UNMODIFIED;
+
delta.old_file.size = old_data.size;
delta.new_file.size = new_data.size;
@@ -762,6 +766,10 @@ int git_diff_blobs(
return error;
}
+ /* don't do hunk and line diffs if the two blobs are identical */
+ if (delta.status == GIT_DELTA_UNMODIFIED)
+ return 0;
+
/* don't do hunk and line diffs if file is binary */
if (delta.binary == 1)
return 0;