Skip to content

Commit e539a83

Browse files
committed
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
2 parents 36d7558 + 00ec50e commit e539a83

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

builtin/fsck.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
759759

760760
if (keep_cache_objects) {
761761
verify_index_checksum = 1;
762+
verify_ce_order = 1;
762763
read_cache();
763764
for (i = 0; i < active_nr; i++) {
764765
unsigned int mode;

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ extern int hold_locked_index(struct lock_file *, int);
745745
extern void set_alternate_index_output(const char *);
746746

747747
extern int verify_index_checksum;
748+
extern int verify_ce_order;
748749

749750
/* Environment bits from configuration mechanism */
750751
extern int trust_executable_bit;

read-cache.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,9 @@ struct ondisk_cache_entry_extended {
15111511
/* Allow fsck to force verification of the index checksum. */
15121512
int verify_index_checksum;
15131513

1514+
/* Allow fsck to force verification of the cache entry order. */
1515+
int verify_ce_order;
1516+
15141517
static int verify_hdr(struct cache_header *hdr, unsigned long size)
15151518
{
15161519
git_SHA_CTX c;
@@ -1668,6 +1671,9 @@ static void check_ce_order(struct index_state *istate)
16681671
{
16691672
unsigned int i;
16701673

1674+
if (!verify_ce_order)
1675+
return;
1676+
16711677
for (i = 1; i < istate->cache_nr; i++) {
16721678
struct cache_entry *ce = istate->cache[i - 1];
16731679
struct cache_entry *next_ce = istate->cache[i];

0 commit comments

Comments
 (0)