Merge branch 'am/sparse-index-name-hash-fix'

Avoid adding directory path to a sparse-index tree entries to the
name-hash, since they would bloat the hashtable without anybody
querying for them.  This was done already for a single threaded
part of the code, but now the multi-threaded code also does the
same.

* am/sparse-index-name-hash-fix:
  name-hash: don't add sparse directories in threaded lazy init
This commit is contained in:
Junio C Hamano
2025-05-30 11:59:16 -07:00

View File

@@ -492,8 +492,10 @@ static void *lazy_name_thread_proc(void *_data)
for (k = 0; k < d->istate->cache_nr; k++) {
struct cache_entry *ce_k = d->istate->cache[k];
ce_k->ce_flags |= CE_HASHED;
hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
hashmap_add(&d->istate->name_hash, &ce_k->ent);
if (!S_ISSPARSEDIR(ce_k->ce_mode)) {
hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name);
hashmap_add(&d->istate->name_hash, &ce_k->ent);
}
}
return NULL;