* 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. */
| 602 | * calling remove_index_entry_at() for each entry to be removed. |
| 603 | */ |
| 604 | void 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 | |
| 629 | int remove_file_from_index(struct index_state *istate, const char *path) |
| 630 | { |
no test coverage detected