summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/handlers/diff_header.rs12
-rw-r--r--src/handlers/hunk_header.rs6
2 files changed, 15 insertions, 3 deletions
diff --git a/src/handlers/diff_header.rs b/src/handlers/diff_header.rs
index 3e317bee..50e1f7aa 100644
--- a/src/handlers/diff_header.rs
+++ b/src/handlers/diff_header.rs
@@ -155,8 +155,16 @@ impl<'a> StateMachine<'a> {
/// Construct file change line from minus and plus file and write with DiffHeader styling.
fn _handle_diff_header_header_line(&mut self, comparing: bool) -> std::io::Result<()> {
let line = get_file_change_description_from_file_paths(
- &self.minus_file,
- &self.plus_file,
+ self.config
+ .minus_file
+ .as_ref()
+ .and_then(|p| p.to_str())
+ .unwrap_or(&self.minus_file),
+ self.config
+ .plus_file
+ .as_ref()
+ .and_then(|p| p.to_str())
+ .unwrap_or(&self.plus_file),
comparing,
&self.minus_file_event,
&self.plus_file_event,
diff --git a/src/handlers/hunk_header.rs b/src/handlers/hunk_header.rs
index 7a9e2a1c..516394d8 100644
--- a/src/handlers/hunk_header.rs
+++ b/src/handlers/hunk_header.rs
@@ -263,7 +263,11 @@ fn paint_file_path_with_line_number(
paint::paint_file_path_with_line_number(
line_number,
- plus_file,
+ config
+ .plus_file
+ .as_ref()
+ .and_then(|p| p.to_str())
+ .unwrap_or(plus_file),
false,
":",
false,