Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hyperlink absolute paths #939

Merged
merged 8 commits into from
Feb 14, 2022
Merged

Conversation

dandavison
Copy link
Owner

There were a few bugs causing hyperlinks to have an incorrect target path -- related to the folllowing:

  • User not being in repo root dir
  • User using git's --relative flag or diff.relative setting
  • User using delta's relative-paths option
  • Delta invoked by git or input piped to delta

An interesting fact is that when delta is invoked by git, the directory associated with the delta process is the repo root dir, even if delta is started in a deeper dir in the repo (this can be seen by doing git -c core.pager=pwd show).

This PR is an attempt to make everything correct. Here's how delta should behave:

  • Absolute paths in hyperlinks must be correct under all circumstances or else a hyperlink must not be displayed
  • If delta's relative-paths option is active, all relative paths displayed to the user should be correct from the user's current directory (so that they can be cat'd, clicked on in terminal emulators that support that such as VSCode's, etc)
  • The above should be true whether diff.relative is enabled or not

@dandavison dandavison merged commit 3d5b685 into master Feb 14, 2022
@dandavison dandavison deleted the 890-hyperlinked-file-paths-2 branch February 14, 2022 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant