From 07dac1e0536a581d0a3636a5a644fbbd62aa8150 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 16 Mar 2023 10:27:43 -0500 Subject: [PATCH] fix(win): Strip of UNC path pefix The hope is this will fix #68 --- Cargo.lock | 1 + Cargo.toml | 1 + src/blame.rs | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6dde85c..7be9d4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -559,6 +559,7 @@ dependencies = [ "concolor", "concolor-clap", "content_inspector", + "dunce", "encoding", "env_logger", "flate2", diff --git a/Cargo.toml b/Cargo.toml index d50f5e0..969dec1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ serde = { version = "1.0.152", features = ["derive"] } flate2 = "1.0.25" once_cell = "1.17.0" bugreport = "0.5.0" +dunce = "1.0.3" [dev-dependencies] snapbox = { version = "0.4.10", features = ["path"] } diff --git a/src/blame.rs b/src/blame.rs index 06f5f50..d9e7ce2 100644 --- a/src/blame.rs +++ b/src/blame.rs @@ -171,8 +171,7 @@ fn to_repo_relative( let workdir = repo.workdir().ok_or_else(|| { anyhow::format_err!("No workdir found; Bare repositories are not supported") })?; - let abs_path = path - .canonicalize() + let abs_path = dunce::canonicalize(path) .with_context(|| anyhow::format_err!("Could not read {}", path.display()))?; let rel_path = abs_path.strip_prefix(workdir).map_err(|_| { anyhow::format_err!(