Copy with a reflink when exporting a tree to a directory special remote
authorJoey Hess <joeyh@joeyh.name>
Tue, 28 Mar 2023 17:06:11 +0000 (13:06 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 28 Mar 2023 17:09:14 +0000 (13:09 -0400)
commita5709dcc2203d83132840d44fb0aed813a8f0f07
tree766e0895501ca1762da7592f15dd52fc950efe2e
parentd2d7d766d8fec7be7c06ecfbb50e903c55488fa2
Copy with a reflink when exporting a tree to a directory special remote

Remote.Directory makes a temp file, then calls this, and since the temp
file exists, it prevented probing if CoW works.

Note that deleting the empty file does mean there's a small window for a
race. If another process is also exporting to the remote, that could let it
make the same temp file. However, the temp filename actually has the
processes's pid in it, which avoids that being a problem.

This may have been a reversion caused by commits around
63d508e8855b2e61a725c906ea17d1c7f4a2e125, but I haven't gone back and
tested to be sure. The directory special remote had supposedly supported
CoW for this going back to about half a year before that.

Sponsored-by: Graham Spencer on Patreon
Annex/CopyFile.hs
CHANGELOG
doc/bugs/use_reflink_to_export_to_directory_special_remote.mdwn