Skip to content

Commit dc7d664

Browse files
derrickstoleegitster
authored andcommitted
packfile: close multi-pack-index in close_all_packs
Whenever we delete pack-files from the object directory, we need to also delete the multi-pack-index that may refer to those objects. Sometimes, this connection is obvious, like during a repack. Other times, this is less obvious, like when gc calls a repack command and then does other actions on the objects, like write a commit-graph file. The pattern we use to avoid out-of-date in-memory packed_git structs is to call close_all_packs(). This should also call close_midx(). Since we already pass an object store to close_all_packs(), this is a nicely scoped operation. This fixes a test failure when running t6500-gc.sh with GIT_TEST_MULTI_PACK_INDEX=1. Reported-by: Szeder Gábor <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0465a50 commit dc7d664

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packfile.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@ void close_all_packs(struct raw_object_store *o)
339339
BUG("want to close pack marked 'do-not-close'");
340340
else
341341
close_pack(p);
342+
343+
if (o->multi_pack_index) {
344+
close_midx(o->multi_pack_index);
345+
o->multi_pack_index = NULL;
346+
}
342347
}
343348

344349
/*

0 commit comments

Comments
 (0)