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

Function remove_marked_cache_entries

read-cache.c:604–627  ·  view source on GitHub ↗

* Remove all cache entries marked for removal, that is where * CE_REMOVE is set in ce_flags. This is much more effective than * calling remove_index_entry_at() for each entry to be removed. */

Source from the content-addressed store, hash-verified

602 * calling remove_index_entry_at() for each entry to be removed.
603 */
604void remove_marked_cache_entries(struct index_state *istate, int invalidate)
605{
606 struct cache_entry **ce_array = istate->cache;
607 unsigned int i, j;
608
609 for (i = j = 0; i < istate->cache_nr; i++) {
610 if (ce_array[i]->ce_flags & CE_REMOVE) {
611 if (invalidate) {
612 cache_tree_invalidate_path(istate,
613 ce_array[i]->name);
614 untracked_cache_remove_from_index(istate,
615 ce_array[i]->name);
616 }
617 remove_name_hash(istate, ce_array[i]);
618 save_or_free_index_entry(istate, ce_array[i]);
619 }
620 else
621 ce_array[j++] = ce_array[i];
622 }
623 if (j == istate->cache_nr)
624 return;
625 istate->cache_changed |= CE_ENTRY_REMOVED;
626 istate->cache_nr = j;
627}
628
629int remove_file_from_index(struct index_state *istate, const char *path)
630{

Callers 5

merge_base_indexFunction · 0.85
check_updatesFunction · 0.85
checkout_worktreeFunction · 0.85
checkout_pathsFunction · 0.85

Calls 4

remove_name_hashFunction · 0.85
save_or_free_index_entryFunction · 0.85

Tested by

no test coverage detected