summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-08-31 20:51:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-01 17:58:43 (GMT)
commitf5909d34ca4956744bc6e058d30546a5ab28ee8b (patch)
tree470dce334e8190acafd7050677e3ce5023e6dacf /midx.c
parent426c00e4541367bcd96e542f971d8995e3bb1d54 (diff)
downloadgit-f5909d34ca4956744bc6e058d30546a5ab28ee8b.zip
git-f5909d34ca4956744bc6e058d30546a5ab28ee8b.tar.gz
git-f5909d34ca4956744bc6e058d30546a5ab28ee8b.tar.bz2
midx: clear auxiliary .rev after replacing the MIDX
When writing a new multi-pack index, write_midx_internal() attempts to clean up any auxiliary files (currently just the MIDX's `.rev` file, but soon to include a `.bitmap`, too) corresponding to the MIDX it's replacing. This step should happen after the new MIDX is written into place, since doing so beforehand means that the old MIDX could be read without its corresponding .rev file. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index 902e1a7..0bcb403 100644
--- a/midx.c
+++ b/midx.c
@@ -1086,10 +1086,11 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
if (flags & MIDX_WRITE_REV_INDEX)
write_midx_reverse_index(midx_name, midx_hash, &ctx);
- clear_midx_files_ext(object_dir, ".rev", midx_hash);
commit_lock_file(&lk);
+ clear_midx_files_ext(object_dir, ".rev", midx_hash);
+
cleanup:
for (i = 0; i < ctx.nr; i++) {
if (ctx.info[i].p) {