I came up with this on top of Taylor's series which fixes the order in which we write files associated with pack files[1]. His series fixes a race where we write *.idx before *.rev, but left the issue of writing *.bitmap after *.idx, this series fixes that. Now we'll really write the *.idx last. There's still a race in these combined serieses, but now it's to do with our general lack of fsync(), i.e. there's no guarantee that just because we write files A, B and C in that order that without doing the proper fsync() dancing on the files and the fd for the directory that other processes will see it that way. In practice though there is, as few/no OS's are so pedantic as to expose inconsistent ordering of written files in a directory, even though POSIX et al leave that possibily open. 1. https://lore.kernel.org/git/cover.1630461918.git.me@xxxxxxxxxxxx/ Ævar Arnfjörð Bjarmason (3): pack-write: use more idiomatic strbuf usage for packname construction pack-write: split up finish_tmp_packfile() function pack-write: rename *.idx file into place last (really!) builtin/pack-objects.c | 33 +++++++++++++++++------ builtin/repack.c | 8 ++++++ pack-write.c | 60 ++++++++++++++++++++++++++++-------------- pack.h | 16 ++++++++++- 4 files changed, 88 insertions(+), 29 deletions(-) -- 2.33.0.818.gd2ef2916285