diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-04-24 08:43:29 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-04-24 16:43:24 -0400 |
commit | dc8a6fc3d48c16f82402d46cd83106cf94ed83fe (patch) | |
tree | cf7e9e2198604801c76a2fcb91579fdda1c13ed2 /src/parse.rs | |
parent | 2cc9b5d296f902704ab19eed308b3c145f9a89e6 (diff) |
Add relative-paths option
Diffstat (limited to 'src/parse.rs')
-rw-r--r-- | src/parse.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parse.rs b/src/parse.rs index 167ae272..d811fb8a 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -31,7 +31,7 @@ pub enum FileEvent { pub fn parse_file_meta_line( line: &str, git_diff_name: bool, - cwd_relative_to_repo_root: Option<&str>, + relative_path_base: Option<&str>, ) -> (String, FileEvent) { let (mut path, file_event) = match line { line if line.starts_with("--- ") || line.starts_with("+++ ") => { @@ -62,8 +62,8 @@ pub fn parse_file_meta_line( _ => ("".to_string(), FileEvent::NoEvent), }; - if let Some(cwd) = cwd_relative_to_repo_root { - if let Some(relative_path) = pathdiff::diff_paths(&path, cwd) { + if let Some(base) = relative_path_base { + if let Some(relative_path) = pathdiff::diff_paths(&path, base) { if let Some(relative_path) = relative_path.to_str() { path = relative_path.to_owned(); } |