@@ -16,7 +16,9 @@ pub type LineChanges = HashMap<u32, LineChange>;
1616pub fn get_git_diff(filename: &str) -> Option<LineChanges> {
1717 let repo = Repository::discover(&filename).ok()?;
1818 let path_absolute = fs::canonicalize(&filename).ok()?;
19− let path_relative_to_repo = path_absolute.strip_prefix(repo.workdir()?).ok()?;
19+ let path_relative_to_repo = path_absolute
20+ .strip_prefix(fs::canonicalize(repo.workdir()?).ok()?)
21+ .ok()?;
2022
2123 let mut diff_options = DiffOptions::new();
2224 let pathspec = path_relative_to_repo.into_c_string().ok()?;