Skip to content

Commit

Permalink
Fix hyperlink absolute paths (#939)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dandavison authored Feb 14, 2022
1 parent b66d1d3 commit 3d5b685
Show file tree
Hide file tree
Showing 13 changed files with 637 additions and 174 deletions.
9 changes: 7 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use crate::parse_styles;
use crate::style;
use crate::style::Style;
use crate::tests::TESTING;
use crate::utils;
use crate::utils::bat::output::PagingMode;
use crate::utils::cwd::cwd_of_user_shell_process;
use crate::utils::regex_replacement::RegexReplacement;
use crate::utils::syntect::FromDeltaStyle;
use crate::wrapping::WrapConfig;
Expand Down Expand Up @@ -245,9 +245,14 @@ impl From<cli::Opt> for Config {

let wrap_max_lines_plus1 = adapt_wrap_max_lines_argument(opt.wrap_max_lines);

#[cfg(not(test))]
let cwd_of_delta_process = std::env::current_dir().ok();
#[cfg(test)]
let cwd_of_delta_process = Some(utils::path::fake_delta_cwd_for_tests());

let cwd_relative_to_repo_root = std::env::var("GIT_PREFIX").ok();
let cwd_of_user_shell_process = cwd_of_user_shell_process(

let cwd_of_user_shell_process = utils::path::cwd_of_user_shell_process(
cwd_of_delta_process.as_ref(),
cwd_relative_to_repo_root.as_deref(),
);
Expand Down
Loading

0 comments on commit 3d5b685

Please sign in to comment.