summaryrefslogtreecommitdiffstats
path: root/src/utils/process.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2022-02-14 12:30:30 -0500
committerGitHub <noreply@github.com>2022-02-14 12:30:30 -0500
commit3d5b6852a06e4aaf2ae8e3b02a3b2e4e59429f22 (patch)
treebf8614847eecec3541b10f26b42f368ebbed0e27 /src/utils/process.rs
parentb66d1d371709205525128fcd80ca302630f8ac9e (diff)
Fix hyperlink absolute paths (#939)0.12.0
Fix file paths and hyperlinks With this commit the target of a hyperlink should always be an absolute path. This should be true for all file hyperlinks, e.g. - File hyperlink - Hunk header hyperlink - Line number hyperlink Fixes #890
Diffstat (limited to 'src/utils/process.rs')
-rw-r--r--src/utils/process.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/process.rs b/src/utils/process.rs
index 0e98024a..a2984090 100644
--- a/src/utils/process.rs
+++ b/src/utils/process.rs
@@ -20,6 +20,18 @@ pub enum CallingProcess {
}
// TODO: Git blame is currently handled differently
+impl CallingProcess {
+ pub fn paths_in_input_are_relative_to_cwd(&self) -> bool {
+ match self {
+ CallingProcess::GitDiff(cmd) if cmd.long_options.contains("--relative") => true,
+ CallingProcess::GitShow(cmd, _) if cmd.long_options.contains("--relative") => true,
+ CallingProcess::GitLog(cmd) if cmd.long_options.contains("--relative") => true,
+ CallingProcess::GitGrep(_) | CallingProcess::OtherGrep => true,
+ _ => false,
+ }
+ }
+}
+
#[derive(Clone, Debug, PartialEq)]
pub struct CommandLine {
pub long_options: HashSet<String>,