Skip to content

Commit 640c99a

Browse files
committed
fix remote clones
1 parent 821037c commit 640c99a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

crates/uv-git/src/git.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,16 @@ impl GitCheckout {
355355
paths::remove_dir_all(into)?;
356356
}
357357

358-
let url = Url::from_file_path(&database.repo.path).map_err(|()| {
359-
anyhow::format_err!("Invalid path URL: {}", database.repo.path.display())
360-
})?;
361-
362358
// Perform a local clone of the repository, which will attempt to use
363359
// hardlinks to set up the repository. This should speed up the clone operation
364360
// quite a bit if it works.
365361
ProcessBuilder::new("git")
366362
.arg("clone")
367363
.arg("--local")
368-
.arg(url.as_str())
364+
// Make sure to pass the local file path and not a file://... url. If given a url,
365+
// Git treats the repository as a remote origin and gets confused because we don't
366+
// have a HEAD checked out.
367+
.arg(&database.repo.path)
369368
.arg(into)
370369
.exec_with_streaming(&mut silent, &mut silent, true)?;
371370

0 commit comments

Comments
 (0)