[PATCH] Re-instate index file write optimization
[gitweb.git] / update-index.c
index ade1ee72ebbe5e6b84a0c6645ff2043b831bdfef..b825a11d2f6d8a53f5e42e4f157ba036a13edb59 100644 (file)
@@ -391,9 +391,11 @@ int main(int argc, const char **argv)
                        update_one(buf.buf, prefix, prefix_length);
                }
        }
-       if (write_cache(newfd, active_cache, active_nr) ||
-           commit_index_file(&cache_file))
-               die("Unable to write new cachefile");
+       if (active_cache_changed) {
+               if (write_cache(newfd, active_cache, active_nr) ||
+                   commit_index_file(&cache_file))
+                       die("Unable to write new cachefile");
+       }
 
        return has_errors ? 1 : 0;
 }