diff options
author | Dan Davison <dandavison7@gmail.com> | 2022-02-14 12:30:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-14 12:30:30 -0500 |
commit | 3d5b6852a06e4aaf2ae8e3b02a3b2e4e59429f22 (patch) | |
tree | bf8614847eecec3541b10f26b42f368ebbed0e27 /src/utils/process.rs | |
parent | b66d1d371709205525128fcd80ca302630f8ac9e (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.rs | 12 |
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>, |