# Re: \[PATCH v4 05/25\] midx: clear auxiliary .rev after replacing the MIDX

- From: Junio C Hamano \<hidden\>
- Date: 2021-08-24 22:05:05 
- List: git
- Page: https://ratatoskr.run/git/2021/08/7900239
- Thread: https://ratatoskr.run/git/2021/08/7900239/t.md

```text
Taylor Blau [ref] writes:

> On Tue, Aug 24, 2021 at 02:12:42PM -0700, Junio C Hamano wrote:
>> Taylor Blau [ref] writes:
>>
>> >> This needs to take object_dir into account, no?
>> >
>> > Yes and no; clear_midx_files_ext() still takes a pointer to a 'struct
>> > repository' until we pick up [1].
>>
>> I was hoping that [1] will become part of this series as a trivial
>> clean-up and bugfix, perhaps in its early part.
>
> Sure, that works even better. I'll send a reroll incorporating it as
> soon as I finish re-testing.

FWIW, here is what I have somewhere in 'seen' where two topics meet.

diff --cc midx.c
index c0209751b5,4574e6d411..0000000000
--- i/midx.c
+++ w/midx.c
@@@ -1090,6 -1351,9 +1351,9 @@@ static int write_midx_internal(const ch
  
  	commit_lock_file(&lk);
  
 -	clear_midx_files_ext(the_repository, ".bitmap", midx_hash);
 -	clear_midx_files_ext(the_repository, ".rev", midx_hash);
++	clear_midx_files_ext(object_dir, ".bitmap", midx_hash);
++	clear_midx_files_ext(object_dir, ".rev", midx_hash);
+ 
  cleanup:
  	for (i = 0; i < ctx.nr; i++) {
  		if (ctx.info[i].p) {
@@@ -1165,7 -1429,8 +1429,8 @@@ void clear_midx_file(struct repository 
  	if (remove_path(midx))
  		die(_("failed to clear multi-pack-index at %s"), midx);
  
 -	clear_midx_files_ext(r, ".bitmap", NULL);
 -	clear_midx_files_ext(r, ".rev", NULL);
++	clear_midx_files_ext(r->objects->odb->path, ".bitmap", NULL);
 +	clear_midx_files_ext(r->objects->odb->path, ".rev", NULL);
  
  	free(midx);
  }
```
