yoannfleurydev/gitweb

Copy/open a specific commit in the browser

Closed this issue · 4 comments

Is your feature request related to a problem? Please describe.
I want to copy/open the URL of a specific commit. Like:

github: https://github.com/yoannfleurydev/gitweb/commit/13a54008f6ac56c74fe132cca2347c099a56f941
bitbucket: https://bitbucket.org/rubenrua/matterhorn/commits/13ca600b0d245100e1bd163277e47cbdb0810620

Describe the solution you'd like
Any like:

gitweb --commit 0b6e00b6 -B ""

Additional context
The same for git tags would be useful.

Very fast first impl in https://github.com/rubenrua/gitweb/tree/wip rubenrua@bb752b8

(Sorry I can't copy the commit :) )

Thanks a lot for your interest in gitweb and for opening this feature request. 👍

It could be great to have this option in gitweb.

As a reminder, here are the different remote behavior:

Commit

github: https://github.com/yoannfleurydev/gitweb/commit/a01acee5bedd03d5968d73ad0f330e4e025bf875
gitlab: https://gitlab.com/gitlab-org/gitlab-foss/-/commit/ecfcccb684722316df4cd6c999a2716b44413733
bitbucket: https://bitbucket.org/rubenrua/matterhorn/commits/13ca600b0d245100e1bd163277e47cbdb0810620

Tags (same placeholder as branches)

Not release as it is not a concept from git. Taking tags as refs.

github: https://github.com/yoannfleurydev/gitweb/tree/v0.1.12
gitlab: https://gitlab.com/gitlab-org/gitlab-foss/-/tree/v12.10.11
bitbucket: https://bitbucket.org/rubenrua/matterhorn/src/1.4.3/

I'll try to take a better look at this when I'll have more time, but your first iteration looks pretty good to me.

Once again, thanks for you interest in this project.

@rubenrua Thanks again for opening this issue. I just checked your solution and it seems really good to me. Only one feedback:

It could be great if the string "bitbucket.org" can be a constant, maybe something like the following:

path = if parts.0 == BITBUCKET_HOSTNAME {"commits"} else {"commit"},

Do you mind opening a PR so your work will be merged in this repository?

Implemented in #6 🎉