summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diff.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 17873f3d9e..f4a23ab1db 100644
--- a/diff.c
+++ b/diff.c
@@ -3758,6 +3758,13 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
len2, p->two->path);
git_SHA1_Update(&ctx, buffer, len1);
+ if (diff_filespec_is_binary(p->one) ||
+ diff_filespec_is_binary(p->two)) {
+ git_SHA1_Update(&ctx, sha1_to_hex(p->one->sha1), 40);
+ git_SHA1_Update(&ctx, sha1_to_hex(p->two->sha1), 40);
+ continue;
+ }
+
xpp.flags = 0;
xecfg.ctxlen = 3;
xecfg.flags = XDL_EMIT_FUNCNAMES;