Skip to content

Commit b5fcb1c

Browse files
avargitster
authored andcommitted
read-cache.c: clear and free "sparse_checkout_patterns"
The "sparse_checkout_patterns" member was added to the "struct index_state" in 836e25c (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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 03267e8 commit b5fcb1c

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

read-cache.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,6 +2558,11 @@ int discard_index(struct index_state *istate)
25582558
free_untracked_cache(istate->untracked);
25592559
istate->untracked = NULL;
25602560

2561+
if (istate->sparse_checkout_patterns) {
2562+
clear_pattern_list(istate->sparse_checkout_patterns);
2563+
FREE_AND_NULL(istate->sparse_checkout_patterns);
2564+
}
2565+
25612566
if (istate->ce_mem_pool) {
25622567
mem_pool_discard(istate->ce_mem_pool, should_validate_cache_entries());
25632568
FREE_AND_NULL(istate->ce_mem_pool);

t/t1011-read-tree-sparse-checkout.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test_description='sparse checkout tests
1212
'
1313

1414
TEST_CREATE_REPO_NO_TEMPLATE=1
15+
TEST_PASSES_SANITIZE_LEAK=true
1516
. ./test-lib.sh
1617
. "$TEST_DIRECTORY"/lib-read-tree.sh
1718

t/t2018-checkout-branch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
test_description='checkout'
44

55
TEST_CREATE_REPO_NO_TEMPLATE=1
6+
TEST_PASSES_SANITIZE_LEAK=true
67
. ./test-lib.sh
78

89
# Arguments: [!] <branch> <oid> [<checkout options>]

t/t6435-merge-sparse.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
test_description='merge with sparse files'
44

55
TEST_CREATE_REPO_NO_TEMPLATE=1
6+
TEST_PASSES_SANITIZE_LEAK=true
67
. ./test-lib.sh
78

89
# test_file $filename $content

0 commit comments

Comments
 (0)