Skip to content

Commit 85129e6

Browse files
committed
fix
1 parent f3cf972 commit 85129e6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/commands/blame.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,23 @@ impl Repository {
196196
file_path.to_string()
197197
};
198198

199+
// do this before normalizing the path
200+
let abs_file_path = repo_root.join(&relative_file_path);
201+
202+
199203
#[cfg(windows)]
200-
let relative_file_path = normalize_to_posix(&relative_file_path);
204+
let relative_file_path = {
205+
let normalized = normalize_to_posix(&relative_file_path);
206+
// Strip leading ./ or .\ if present
207+
normalized.strip_prefix("./").unwrap_or(&normalized).to_string()
208+
};
201209

202210
#[cfg(not(windows))]
203-
let relative_file_path = relative_file_path;
211+
let relative_file_path = {
212+
// Also strip leading ./ on non-Windows for consistency
213+
relative_file_path.strip_prefix("./").unwrap_or(&relative_file_path).to_string()
214+
};
204215

205-
let abs_file_path = repo_root.join(&relative_file_path);
206216

207217
// Validate that the file exists
208218
if !abs_file_path.exists() {

0 commit comments

Comments
 (0)