summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-11-08 19:17:40 +0100
committerJunio C Hamano <gitster@pobox.com>2022-11-21 12:32:48 +0900
commitb5fcb1c006cd566b567a5249a53d3ee5a51f299a (patch)
tree265dd06b42376c037360cd122d23436c50ae8785 /read-cache.c
parent03267e8656c23cf1e2d1df8204d4cee236fb0077 (diff)
downloadgit-b5fcb1c006cd566b567a5249a53d3ee5a51f299a.tar.gz
read-cache.c: clear and free "sparse_checkout_patterns"
The "sparse_checkout_patterns" member was added to the "struct index_state" in 836e25c51b2 (sparse-checkout: hold pattern list in index, 2021-03-30), but wasn't added to discard_index(). Let's do that. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index 3202402927..7c6477487a 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2558,6 +2558,11 @@ int discard_index(struct index_state *istate)
free_untracked_cache(istate->untracked);
istate->untracked = NULL;
+ if (istate->sparse_checkout_patterns) {
+ clear_pattern_list(istate->sparse_checkout_patterns);
+ FREE_AND_NULL(istate->sparse_checkout_patterns);
+ }
+
if (istate->ce_mem_pool) {
mem_pool_discard(istate->ce_mem_pool, should_validate_cache_entries());
FREE_AND_NULL(istate->ce_mem_pool);