test: add test cases for relative_path
[gitweb.git] / name-hash.c
index 6d7e1980c62f96fc3614ddd130ce25a765fceae5..617c86c53762575373d0bcbf3d8bab09cb042caa 100644 (file)
@@ -150,6 +150,8 @@ static void lazy_init_name_hash(struct index_state *istate)
 
        if (istate->name_hash_initialized)
                return;
+       if (istate->cache_nr)
+               preallocate_hash(&istate->name_hash, istate->cache_nr);
        for (nr = 0; nr < istate->cache_nr; nr++)
                hash_index_entry(istate, istate->cache[nr]);
        istate->name_hash_initialized = 1;