Skip to content

Commit f5909d3

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 426c00e commit f5909d3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

midx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,10 +1086,11 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
10861086

10871087
if (flags & MIDX_WRITE_REV_INDEX)
10881088
write_midx_reverse_index(midx_name, midx_hash, &ctx);
1089-
clear_midx_files_ext(object_dir, ".rev", midx_hash);
10901089

10911090
commit_lock_file(&lk);
10921091

1092+
clear_midx_files_ext(object_dir, ".rev", midx_hash);
1093+
10931094
cleanup:
10941095
for (i = 0; i < ctx.nr; i++) {
10951096
if (ctx.info[i].p) {

0 commit comments

Comments
 (0)