From b7bbf8cb8b3814c7591626d162b2cb2c3f3ef223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Garde?= Date: Wed, 16 Jun 2021 23:29:10 +0200 Subject: [PATCH] fix windows path handling in blame view --- asyncgit/src/sync/blame.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/asyncgit/src/sync/blame.rs b/asyncgit/src/sync/blame.rs index 4b5b02883b..f1aecae178 100644 --- a/asyncgit/src/sync/blame.rs +++ b/asyncgit/src/sync/blame.rs @@ -50,7 +50,15 @@ pub fn blame_file( let commit_id = utils::get_head_repo(&repo)?; - let spec = format!("{}:{}", commit_id.to_string(), file_path); + let spec = if cfg!(unix) { + format!("{}:{}", commit_id.to_string(), file_path) + } else { + format!( + "{}:{}", + commit_id.to_string(), + file_path.replace("\\", "/") + ) + }; let object = repo.revparse_single(&spec)?; let blob = repo.find_blob(object.id())?;