Merge branch 'bp/read-index-from-skip-verification'

Drop (perhaps overly cautious) sanity check before using the index
read from the filesystem at runtime.

* bp/read-index-from-skip-verification:
  read_index_from(): speed index loading by skipping verification of the entry order
This commit is contained in:
Junio C Hamano 2017-11-15 12:14:37 +09:00
commit e539a83455
3 changed files with 8 additions and 0 deletions

View File

@ -759,6 +759,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
if (keep_cache_objects) {
verify_index_checksum = 1;
verify_ce_order = 1;
read_cache();
for (i = 0; i < active_nr; i++) {
unsigned int mode;

View File

@ -745,6 +745,7 @@ extern int hold_locked_index(struct lock_file *, int);
extern void set_alternate_index_output(const char *);
extern int verify_index_checksum;
extern int verify_ce_order;
/* Environment bits from configuration mechanism */
extern int trust_executable_bit;

View File

@ -1511,6 +1511,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;
@ -1668,6 +1671,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];