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

🚀 Enable delta when producing a git log or diff in a shell pipeline #1731

Closed
unphased opened this issue Jun 27, 2024 · 2 comments
Closed

Comments

@unphased
Copy link

unphased commented Jun 27, 2024

I have a huge and simple feature I want to add to delta git log browsing which is to enable OSC8 Hyperlink support in the files listed in delta's diffs.

Delta is my go-to git diff browser. Now that I use AI to write code more than I manually edit code, I spend a lot less time viewing git diffs via git diff and more time viewing diffs in git log -p. But that doesn't matter. For both git diff and git log -p the most practical way to add hyperlink support (which needs some custom reconciliation with code I've hooked into alacritty which does some slick logic for choosing the correct nvim instance to puppeteer) I need to just send the output of git diff and git log -p (in particular rendered via delta) into a shell script so I can do some simple work with sed to have all file paths become properly hyperlinked.

This is proving difficult as once you run either of these from a shell script they will not get delta pager goodies. I can't get it by specifying GIT_PAGER as delta either though that was a long shot anyway. I'd like for there to exist a way to force git to produce a diff or log with the usual features (ability to specify more flags if necessary) but while forcing delta on always.

It may be possible to use some PTY wrapper tool but this is not the answer, because it would be only be receiving just the first page of the paged output.

@unphased unphased changed the title 🚀 Enable delta when viewing a delta powered git log in a shell pipeline 🚀 Enable delta when producing a git log or diff in a shell pipeline Jun 27, 2024
@unphased
Copy link
Author

I believe a standard pattern is intended to fulfill my need, so I will close this but please do feel free to add any suggestions.

git log -p | delta does the trick for me and i can keep piping that on to do whatever I need. E.g.: git log -p | delta | sed s/a/z/g

@unphased
Copy link
Author

unphased commented Jun 27, 2024

note to onlookers, yeah i went down this path without reviewing documentation, hyperlinks had been added to delta like a year ago, and it is quite nearly enough for what i need. So don't be like me...

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

No branches or pull requests

1 participant