Merge branch 'jk/diff-do-not-reuse-wtf-needs-cleaning'
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 7d0341988083dae44f8833875762b0b978bbafc0..b43d3dd2ecb7b2154ce6c445983e23ce89c69111 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2683,6 +2683,13 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
        if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1))
                return 0;
 
+       /*
+        * Similarly, if we'd have to convert the file contents anyway, that
+        * makes the optimization not worthwhile.
+        */
+       if (!want_file && would_convert_to_git(name))
+               return 0;
+
        len = strlen(name);
        pos = cache_name_pos(name, len);
        if (pos < 0)