uv/crates/install-wheel-rs
Abdó Roig-Maranges 542afe7474
Fix link-mode=clone on linux (#7620)
- **Do not attempt to reflink directories on linux**
- **Refactor clone_recursive**

## Summary

On linux, reflink does not work on a directory. Currently, we first
attempt to reflink directory, and only if it fails with `AlreadyExists`
we attempt to reflink recursively.

This has the effect that, on linux, `uv pip install --link-mode=clone`
would always fall back to `copy`.

We resolve this by only attempting to reflink directories on macos. In
the process, we refactored `clone_recursive` in an attempt to make it
easier to reason about its logic.


## Test Plan

I tested that after this change, `uv pip install --link-mode=clone
numpy` would behave as expected in the following cases:

* linux, btrfs filesystem, venv on the same filesystem as cache
(correctly reflinked)
* linux, btrfs filesystem, venv on a different filesystem than cache
(fallback to copy)

I have not tested it on macos or windows, as I currently don't have
access to any macos or windows machines, unfortunately.
2024-09-22 13:40:52 -04:00
..
src Fix link-mode=clone on linux (#7620) 2024-09-22 13:40:52 -04:00
Cargo.toml Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00