# Re: \[PATCH 4/9\] pack-write.c: rename \`.idx\` files after \`\*.rev\`

- From: Junio C Hamano \<hidden\>
- Date: 2021-09-09 19:32:59 
- List: git
- Page: https://ratatoskr.run/git/2021/09/7901888
- Thread: https://ratatoskr.run/git/2021/09/7901888/t.md

```text
Taylor Blau [ref] writes:

> This still leaves the issue of `.idx` files being renamed into place
> before the auxiliary `.bitmap` file is renamed when in pack-object.c's
> write_pack_file() "write_bitmap_index" is true. That race will be
> addressed in subsequent commits.

OK.  I was about to suggest s/after .*rev/last/ on the title, but
the above makes it clear that we are not ready for such a title.

>
> Signed-off-by: Taylor Blau <redacted>
> Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
> Signed-off-by: Taylor Blau <redacted>
> ---
>  pack-write.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/pack-write.c b/pack-write.c
> index 95b063be94..077710090e 100644
> --- a/pack-write.c
> +++ b/pack-write.c
> @@ -491,9 +491,9 @@ void finish_tmp_packfile(struct strbuf *name_buffer,
>  				      pack_idx_opts->flags);
>  
>  	rename_tmp_packfile(name_buffer, pack_tmp_name, "pack");
> -	rename_tmp_packfile(name_buffer, idx_tmp_name, "idx");
>  	if (rev_tmp_name)
>  		rename_tmp_packfile(name_buffer, rev_tmp_name, "rev");
> +	rename_tmp_packfile(name_buffer, idx_tmp_name, "idx");
>  
>  	free((void *)idx_tmp_name);
>  }
```
