From 239f1ea0cbb1d68283dc72d317ea5dc84954cc87 Mon Sep 17 00:00:00 2001 From: Aria Desires Date: Tue, 11 Feb 2025 09:46:30 -0500 Subject: [PATCH 1/3] retry local clones without hardlinks if they fail --- crates/uv-git/src/git.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/uv-git/src/git.rs b/crates/uv-git/src/git.rs index cf3e0ed17386..82eb76394f23 100644 --- a/crates/uv-git/src/git.rs +++ b/crates/uv-git/src/git.rs @@ -422,7 +422,7 @@ impl GitCheckout { // Perform a local clone of the repository, which will attempt to use // hardlinks to set up the repository. This should speed up the clone operation // quite a bit if it works. - ProcessBuilder::new(GIT.as_ref()?) + let res = ProcessBuilder::new(GIT.as_ref()?) .arg("clone") .arg("--local") // Make sure to pass the local file path and not a file://... url. If given a url, @@ -430,7 +430,17 @@ impl GitCheckout { // have a HEAD checked out. .arg(database.repo.path.simplified_display().to_string()) .arg(into.simplified_display().to_string()) - .exec_with_output()?; + .exec_with_output(); + + if let Err(e) = res { + debug!("Cloning git repo with --local failed, retrying without hardlinks: {e}"); + + ProcessBuilder::new(GIT.as_ref()?) + .arg("clone") + .arg(database.repo.path.simplified_display().to_string()) + .arg(into.simplified_display().to_string()) + .exec_with_output()?; + } let repo = GitRepository::open(into)?; let checkout = GitCheckout::new(revision, repo); From 4ec2f74f4b15c184f50a1086fb6d824fb2f3ce55 Mon Sep 17 00:00:00 2001 From: Aria Desires Date: Tue, 11 Feb 2025 10:27:58 -0500 Subject: [PATCH 2/3] explicitly ask for no hard links --- crates/uv-git/src/git.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/uv-git/src/git.rs b/crates/uv-git/src/git.rs index 82eb76394f23..1ff89162182d 100644 --- a/crates/uv-git/src/git.rs +++ b/crates/uv-git/src/git.rs @@ -437,6 +437,7 @@ impl GitCheckout { ProcessBuilder::new(GIT.as_ref()?) .arg("clone") + .arg("--no-hard-links") .arg(database.repo.path.simplified_display().to_string()) .arg(into.simplified_display().to_string()) .exec_with_output()?; From 70a4a85f418085188a8006fa3c2c3461b82f6ebf Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 11 Feb 2025 16:20:38 -0500 Subject: [PATCH 3/3] Update crates/uv-git/src/git.rs Co-authored-by: Filippo Vicentini --- crates/uv-git/src/git.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/uv-git/src/git.rs b/crates/uv-git/src/git.rs index 1ff89162182d..f2953bf43319 100644 --- a/crates/uv-git/src/git.rs +++ b/crates/uv-git/src/git.rs @@ -437,7 +437,7 @@ impl GitCheckout { ProcessBuilder::new(GIT.as_ref()?) .arg("clone") - .arg("--no-hard-links") + .arg("--no-hardlinks") .arg(database.repo.path.simplified_display().to_string()) .arg(into.simplified_display().to_string()) .exec_with_output()?;