summaryrefslogtreecommitdiff
path: root/t/t4013/diff.format-patch_--stdout_initial..master
diff options
context:
space:
mode:
authorTed Nyman <tnyman@openai.com>2026-07-26 17:28:41 -0700
committerJunio C Hamano <gitster@pobox.com>2026-07-27 12:57:20 -0700
commit5e855d9b426dd01552ecbfb47062b90fe53b3df5 (patch)
tree562f4c85177044694971b1432889c0304a2514e3 /t/t4013/diff.format-patch_--stdout_initial..master
parent85f4f04f820c9aa6cfdfb4594ceb9b41515a8245 (diff)
http: avoid concurrent appends to partial packs
Pack requests stage downloads in a predictable partial-pack file so an interrupted transfer can be resumed. Both packfile URI and ordinary dumb HTTP requests use this staging path. Opening it in append mode forces each write to the current end of the file, so concurrent responses can append duplicate data and corrupt the pack. Open the partial pack read-write without O_APPEND and seek once to its current end. Each downloader then retains the offset matching the Range it requested. Because the staging key must uniquely identify immutable pack contents, overlapping responses write the same bytes at the same offsets instead of extending the file with duplicate data. Duplicate the staging descriptor for index-pack instead of reopening the path after closing the stream. Another downloader may unlink the staging path before indexing begins, but index-pack can still read the retained descriptor. Exercise resumed transfers and overlapping 200 and 206 responses, and clarify the staging-key documentation. Signed-off-by: Ted Nyman <tnyman@openai.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.format-patch_--stdout_initial..master')
0 files changed, 0 insertions, 0 deletions