summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2022-03-15 19:22:15 -0400
committerDan Davison <dandavison7@gmail.com>2022-03-16 09:23:05 -0400
commitdd19c974baadae1a1565067130b3eb81770123b1 (patch)
tree66759fb3a4686dc47f36508fcaa076be971607f6
parentc2de30e5cdeb3e2a5e35365d486cb05c86d2478f (diff)
Apply file-transformation to diff header, in addition to hunk header
Fixes #1010
-rw-r--r--src/handlers/diff_header.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/handlers/diff_header.rs b/src/handlers/diff_header.rs
index d00bab10..3e317bee 100644
--- a/src/handlers/diff_header.rs
+++ b/src/handlers/diff_header.rs
@@ -354,12 +354,21 @@ pub fn get_file_change_description_from_file_paths(
plus_file
)
} else {
- let format_file = |file| match (config.hyperlinks, utils::path::absolute_path(file, config))
- {
- (true, Some(absolute_path)) => {
- features::hyperlinks::format_osc8_file_hyperlink(absolute_path, None, file, config)
+ let format_file = |file| {
+ let formatted_file = if let Some(regex_replacement) = &config.file_regex_replacement {
+ regex_replacement.execute(file)
+ } else {
+ Cow::from(file)
+ };
+ match (config.hyperlinks, utils::path::absolute_path(file, config)) {
+ (true, Some(absolute_path)) => features::hyperlinks::format_osc8_file_hyperlink(
+ absolute_path,
+ None,
+ &formatted_file,
+ config,
+ ),
+ _ => formatted_file,
}
- _ => Cow::from(file),
};
match (minus_file, plus_file, minus_file_event, plus_file_event) {
(minus_file, plus_file, _, _) if minus_file == plus_file => format!(