MCPcopy Create free account
hub / github.com/git/git / validate_cache_entries

Function validate_cache_entries

read-cache.c:2469–2492  ·  view source on GitHub ↗

* Validate the cache entries of this index. * All cache entries associated with this index * should have been allocated by the memory pool * associated with this index, or by a referenced * split index. */

Source from the content-addressed store, hash-verified

2467 * split index.
2468 */
2469void validate_cache_entries(const struct index_state *istate)
2470{
2471 int i;
2472
2473 if (!should_validate_cache_entries() ||!istate || !istate->initialized)
2474 return;
2475
2476 for (i = 0; i < istate->cache_nr; i++) {
2477 if (!istate) {
2478 BUG("cache entry is not allocated from expected memory pool");
2479 } else if (!istate->ce_mem_pool ||
2480 !mem_pool_contains(istate->ce_mem_pool, istate->cache[i])) {
2481 if (!istate->split_index ||
2482 !istate->split_index->base ||
2483 !istate->split_index->base->ce_mem_pool ||
2484 !mem_pool_contains(istate->split_index->base->ce_mem_pool, istate->cache[i])) {
2485 BUG("cache entry is not allocated from expected memory pool");
2486 }
2487 }
2488 }
2489
2490 if (istate->split_index)
2491 validate_cache_entries(istate->split_index->base);
2492}
2493
2494int unmerged_index(const struct index_state *istate)
2495{

Callers 2

run_builtinFunction · 0.85
release_indexFunction · 0.85

Calls 2

mem_pool_containsFunction · 0.85

Tested by

no test coverage detected