read_index_from(): speed index loading by skipping verification of the entry order
[gitweb.git] / read-cache.c
index 5e6d24d44450d9408b461f05cf55b51035ae11dc..945a377447e69427c5b67210d507ff4993be565f 100644 (file)
@@ -1509,6 +1509,9 @@ struct ondisk_cache_entry_extended {
 /* Allow fsck to force verification of the index checksum. */
 int verify_index_checksum;
 
+/* Allow fsck to force verification of the cache entry order. */
+int verify_ce_order;
+
 static int verify_hdr(struct cache_header *hdr, unsigned long size)
 {
        git_SHA_CTX c;
@@ -1666,6 +1669,9 @@ static void check_ce_order(struct index_state *istate)
 {
        unsigned int i;
 
+       if (!verify_ce_order)
+               return;
+
        for (i = 1; i < istate->cache_nr; i++) {
                struct cache_entry *ce = istate->cache[i - 1];
                struct cache_entry *next_ce = istate->cache[i];