Subject: [PATCH 0/2] pack-write,repack: prevent opening packs too early

From: Taylor Blau <[email-masked]>
Date: Tue, 31 Aug 2021 22:05:46 -0400

This pair of patches fixes a race where the .idx is moved into place
before the .rev file, allowing the pack to be in a state where it
appears a .rev file wasn't generated.

This can cause Git to inadvertently take the slow "generate the
reverse index on-the-fly", which does not impact correctness, but is
unnecessarily slow when compared to reading the .rev file.

The race is fixed by moving the .idx into place only after all other
pack-related files have already been written. The first patch fixes
the direct `pack-objects` case, and the second patch fixes `repack`
(which also renames pack files around).

Thanks in advance for your review.

Taylor Blau (2):
  pack-write.c: rename `.idx` file into place last
  builtin/repack.c: move `.idx` files into place last

 builtin/repack.c |  2 +-
 pack-write.c     | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.33.0.96.g73915697e6