mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Remove UNC prefixes on Windows (#1086)
## Summary This PR adds a `NormalizedDisplay` trait that we can use for user-facing paths, to strip the UNC prefix on Windows. On other platforms, the implementation is a no-op (vs. `Display`). I audited all usages of `.display()`, and changed any that were user-facing, either via `println!` or `eprintln!`, or by way of being included in error messages. I did _not_ change uses that were only in tests or only went to tracing. Closes https://github.com/astral-sh/puffin/issues/1084.
This commit is contained in:
parent
035cd81ac8
commit
f4939e50a6
23 changed files with 98 additions and 43 deletions
|
@ -14,6 +14,7 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
cache-key = { path = "../cache-key" }
|
||||
puffin-fs = { path = "../puffin-fs" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
cargo-util = { workspace = true }
|
||||
|
|
|
@ -9,6 +9,7 @@ use std::{env, str};
|
|||
use anyhow::{anyhow, Context as _, Result};
|
||||
use cargo_util::{paths, ProcessBuilder};
|
||||
use git2::{self, ErrorClass, ObjectType};
|
||||
use puffin_fs::NormalizedDisplay;
|
||||
use reqwest::Client;
|
||||
use reqwest::StatusCode;
|
||||
use tracing::{debug, warn};
|
||||
|
@ -149,7 +150,7 @@ impl GitRemote {
|
|||
let reference = locked_ref.as_ref().unwrap_or(reference);
|
||||
if let Some(mut db) = db {
|
||||
fetch(&mut db.repo, self.url.as_str(), reference, strategy, client)
|
||||
.with_context(|| format!("failed to fetch into: {}", into.display()))?;
|
||||
.with_context(|| format!("failed to fetch into: {}", into.normalized_display()))?;
|
||||
|
||||
let resolved_commit_hash = match locked_rev {
|
||||
Some(rev) => db.contains(rev).then_some(rev),
|
||||
|
@ -169,7 +170,7 @@ impl GitRemote {
|
|||
paths::create_dir_all(into)?;
|
||||
let mut repo = init(into, true)?;
|
||||
fetch(&mut repo, self.url.as_str(), reference, strategy, client)
|
||||
.with_context(|| format!("failed to clone into: {}", into.display()))?;
|
||||
.with_context(|| format!("failed to clone into: {}", into.normalized_display()))?;
|
||||
let rev = match locked_rev {
|
||||
Some(rev) => rev,
|
||||
None => reference.resolve(&repo)?,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue