]> git.ipfire.org Git - thirdparty/git.git/commit
http: permit unlinking partial packs on Windows
authorTed Nyman <tnyman@openai.com>
Mon, 27 Jul 2026 00:28:42 +0000 (17:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Jul 2026 19:57:20 +0000 (12:57 -0700)
commite92a518a741ead85634c43f871e7e095bcf66f1f
tree382b9974720f959998ad760b8e04e07b46494d77
parent5e855d9b426dd01552ecbfb47062b90fe53b3df5
http: permit unlinking partial packs on Windows

On Windows, an open file must permit FILE_SHARE_DELETE before another
process can unlink it. MinGW's non-append O_RDWR open enables that
sharing mode only for an existing file; adding O_CREAT falls back to
_wopen(), which cannot set it.

First try opening the partial pack without O_CREAT. If it does not
exist, create it exclusively, close that descriptor, and retry through
the existing-file path. A racing creator retries after EEXIST.

This ensures that every retained descriptor permits another downloader
to unlink the staging path. Add an unlink-while-indexing test that does
not require FIFOs and can therefore run on MinGW.

Signed-off-by: Ted Nyman <tnyman@openai.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c
t/t5550-http-fetch-dumb.sh