diff options
author | Marcelo Lima <marcelowind@gmail.com> | 2019-11-22 21:02:11 +0100 |
---|---|---|
committer | Marcelo Lima <marcelowind@gmail.com> | 2019-11-22 21:02:11 +0100 |
commit | b6a9a635f09208dd82085c79d63711ce1a0ba3ac (patch) | |
tree | 0d3e4ebe5d7fa53a8e37693b980b77bd72e55e04 /src/parse.rs | |
parent | 5daa9ba7cec96ca0c868b23676dd38c968d7a04e (diff) |
* Trim out the date from diff -u file name
* Change diff -u function name and add doc
* Handle file uniqueness after a hunk change
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 3480ab8b..a4384d42 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -25,7 +25,7 @@ pub fn get_file_extension_from_marker_line(line: &str) -> Option<&str> { .and_then(|file| file.split('.').last()) } -pub fn get_file_path_from_file_meta_line(line: &str, remove_prefix: bool) -> String { +pub fn get_file_path_from_file_meta_line(line: &str, git_diff_name: bool) -> String { if line.starts_with("rename") { match line.split(' ').nth(2) { Some(path) => path, @@ -36,10 +36,10 @@ pub fn get_file_path_from_file_meta_line(line: &str, remove_prefix: bool) -> Str match line.split(' ').nth(1) { Some("/dev/null") => "/dev/null", Some(path) => { - if remove_prefix { + if git_diff_name { &path[2..] } else { - path + path.split('\t').next().unwrap_or("") } } _ => "", |