diff options
author | Taylor Blau <me@ttaylorr.com> | 2021-09-09 19:24:41 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-09 18:23:11 -0700 |
commit | 16a86907bca0ae7ed9f1dfaa6261234215151396 (patch) | |
tree | e0eaf602b27115116333dc4c03751867945920cb /builtin | |
parent | pack-write: refactor renaming in finish_tmp_packfile() (diff) | |
download | tgif-16a86907bca0ae7ed9f1dfaa6261234215151396.tar.xz |
pack-write.c: rename `.idx` files after `*.rev`
We treat the presence of an `.idx` file as the indicator of whether or
not it's safe to use a packfile. But `finish_tmp_packfile()` (which is
responsible for writing the pack and moving the temporary versions of
all of its auxiliary files into place) is inconsistent about the write
order.
Specifically, it moves the `.rev` file into place after the `.idx`,
leaving open the possibility to open a pack which looks "ready" (because
the `.idx` file exists and is readable) but appears momentarily to not
have a `.rev` file. This causes Git to fall back to generating the
pack's reverse index in memory.
Though racy, this amounts to an unnecessary slow-down at worst, and
doesn't affect the correctness of the resulting reverse index.
Close this race by moving the .rev file into place before moving the
.idx file into place.
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.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
0 files changed, 0 insertions, 0 deletions