Merge branch 'sb/config-write-fix'
[gitweb.git] / builtin / diff-tree.c
index 91ba67070e252fa13a0e32e08a251ca58c7f930b..d07bf2e4c4b5c2ec2f93930c0dd16897df32b25f 100644 (file)
@@ -163,9 +163,11 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
                int saved_nrl = 0;
                int saved_dcctc = 0;
 
-               if (opt->diffopt.detect_rename)
-                       opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE |
-                                              DIFF_SETUP_USE_CACHE);
+               if (opt->diffopt.detect_rename) {
+                       if (!the_index.cache)
+                               read_index(&the_index);
+                       opt->diffopt.setup |= DIFF_SETUP_USE_SIZE_CACHE;
+               }
                while (fgets(line, sizeof(line), stdin)) {
                        struct object_id oid;