diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-04-26 18:07:12 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-04-26 18:33:27 -0400 |
commit | b2b75766947880049302664069a47d30409ece8a (patch) | |
tree | b5dbee99415caea9d30cdb610e68dd5adb594ecc /src/parse.rs | |
parent | 51511870925ac83ee04626cb284ea574eb09b30c (diff) |
Fix parsing file-path-containing-spaces from file meta line
Diffstat (limited to 'src/parse.rs')
-rw-r--r-- | src/parse.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/parse.rs b/src/parse.rs index 0df306dd..cd774a79 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -29,13 +29,13 @@ pub fn get_file_path_from_file_meta_line(line: &str, git_diff_name: bool) -> Str if line.starts_with("rename ") { line.split(' ').skip(2).collect::<Vec<&str>>().join(" ") } else { - match line.split(' ').nth(1) { - Some("/dev/null") => "/dev/null", - Some(path) if git_diff_name && (path.starts_with("a/") || path.starts_with("b/")) => { + match line.split(' ').skip(1).collect::<Vec<&str>>().join(" ") { + path if path == "/dev/null" => "/dev/null", + path if git_diff_name && (path.starts_with("a/") || path.starts_with("b/")) => { &path[2..] } - Some(path) if git_diff_name => path, - Some(path) => path.split('\t').next().unwrap_or(""), + path if git_diff_name => path, + path => path.split('\t').next().unwrap_or(""), _ => "", } .to_string() |