diff: fix handling of binary rewrite diffs
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index e21af3b7ee0d5a0871f76dcbb1acced2345c6ea8..50277b82b2289395fd11a3d5b4d63cf45f825a51 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1376,7 +1376,9 @@ static void builtin_diff(const char *name_a,
                 */
                if ((one->mode ^ two->mode) & S_IFMT)
                        goto free_ab_and_return;
-               if (complete_rewrite) {
+               if (complete_rewrite &&
+                   !diff_filespec_is_binary(one) &&
+                   !diff_filespec_is_binary(two)) {
                        emit_rewrite_diff(name_a, name_b, one, two, o);
                        o->found_changes = 1;
                        goto free_ab_and_return;