completion: support excluding refs
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index d3734d3181b7eebedf80bf6f3d534c61961dca9f..abff2eec2b0604786b09ff0ac7fae24e1df6677f 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -26,7 +26,7 @@
 #endif
 
 static int diff_detect_rename_default;
-static int diff_compaction_heuristic = 1;
+static int diff_compaction_heuristic; /* experimental */
 static int diff_rename_limit_default = 400;
 static int diff_suppress_blank_empty;
 static int diff_use_color_default = -1;
@@ -2682,6 +2682,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)