summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorThomas Gummerer <t.gummerer@gmail.com>2018-12-20 13:48:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-02 23:28:05 (GMT)
commit6fdc2057225ad1ae735ecaacdcace77c8b0b6b76 (patch)
treed40292266321be1a88645a3f8c9c091836ed129f /read-cache.c
parent536ec1839dbde8b9a6b38e6ccb5ab01b2b6311f9 (diff)
downloadgit-6fdc2057225ad1ae735ecaacdcace77c8b0b6b76.zip
git-6fdc2057225ad1ae735ecaacdcace77c8b0b6b76.tar.gz
git-6fdc2057225ad1ae735ecaacdcace77c8b0b6b76.tar.bz2
read-cache: add invalidate parameter to remove_marked_cache_entries
When marking cache entries for removal, and later removing them all at once using 'remove_marked_cache_entries()', cache entries currently have to be invalidated manually in the cache tree and in the untracked cache. Add an invalidate flag to the function. With the flag set, the function will take care of invalidating the path in the cache tree and in the untracked cache. Note that the current callsites already do the invalidation properly in other places, so we're just passing 0 from there to keep the status quo. This will be useful in a subsequent commit. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index bd45dc3..978d43f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -590,13 +590,19 @@ int remove_index_entry_at(struct index_state *istate, int pos)
* CE_REMOVE is set in ce_flags. This is much more effective than
* calling remove_index_entry_at() for each entry to be removed.
*/
-void remove_marked_cache_entries(struct index_state *istate)
+void remove_marked_cache_entries(struct index_state *istate, int invalidate)
{
struct cache_entry **ce_array = istate->cache;
unsigned int i, j;
for (i = j = 0; i < istate->cache_nr; i++) {
if (ce_array[i]->ce_flags & CE_REMOVE) {
+ if (invalidate) {
+ cache_tree_invalidate_path(istate,
+ ce_array[i]->name);
+ untracked_cache_remove_from_index(istate,
+ ce_array[i]->name);
+ }
remove_name_hash(istate, ce_array[i]);
save_or_free_index_entry(istate, ce_array[i]);
}