delta icon indicating copy to clipboard operation
delta copied to clipboard

🚀 Hyperlink pull request and issue numbers

Open PatrickF1 opened this issue 1 year ago • 6 comments

Hi Dan, first off thanks so much for making Delta. Switched from diff-so-fancy 2 months ago and never looked back!

I make use of the hyperlink feature a lot. I think one way we can enhance it is to support pull request links in the commit log. When you merge PRs on Github, you may have noticed it'll append (#pr-number) at the end of the commit message. Maybe delta can hyperlink those?

Screenshot 2023-07-20 at 11 23 03 AM

PatrickF1 avatar Jul 20 '23 18:07 PatrickF1

Hi @PatrickF1, that seems like a great idea and very doable. If you have any interest in implementing it then don't hold back!

dandavison avatar Jul 20 '23 21:07 dandavison

Hi Dan, happy to take a stab at it. Could you link me to where the feature for hyperlinked sha's is limited?

PatrickF1 avatar Aug 21 '23 05:08 PatrickF1

Hi Patrick, sorry for the slow reply, I was offline. Commit SHAs are hyperlinked here: https://github.com/dandavison/delta/blob/7375f7a165dabe430e12d531fedd84bb3a027c6b/src/handlers/commit_meta.rs#L37

dandavison avatar Sep 07 '23 15:09 dandavison

The client can't really tell if #123 is an issue or a pull request, so I think it should linkify all of them as issues, and rely on the server to redirect if the number is a pull request. This would allow supporting commit message lines like Fixes #123 too.

For example, note how https://github.com/dandavison/delta/issues/1573 gets redirected to https://github.com/dandavison/delta/pull/1573.

mvdan avatar Dec 30 '23 20:12 mvdan

Good point. I know GitHub handles redirects well.

On Sat, Dec 30, 2023 at 12:12 PM Daniel Martí @.***> wrote:

The client can't really tell if #123 is an issue or a pull request, so I think it should linkify all of them as issues, and rely on the server to redirect if the number is a pull request. This would allow supporting commit message lines like Fixes #123 too.

For example, note how https://github.com/dandavison/delta/issues/1573 gets redirected to https://github.com/dandavison/delta/pull/1573.

— Reply to this email directly, view it on GitHub https://github.com/dandavison/delta/issues/1482#issuecomment-1872596890, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPAJECTGG7OCHKTDYXQ4YTYMBYSDAVCNFSM6AAAAAA2RZ664WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGU4TMOBZGA . You are receiving this because you were mentioned.Message ID: @.***>

PatrickF1 avatar Dec 30 '23 20:12 PatrickF1

As a slight optimization, we could probably send (#number) to /pull and #number to /issues, since most of the time, pull requests are added by GitHub in the commit with parens around them.

Btw, in case anyone is waiting on me to implement this, I no longer plan on doing it. Learning Rust proved to be too big of a hurdle to jump. I hope someone else will take this on, thanks!

PatrickF1 avatar Dec 30 '23 20:12 PatrickF1