rmuslimov / browse-at-remote

Browse target page on github/bitbucket from emacs buffers
232 stars 53 forks source link

Fix stash URL for detached head. #86

Closed lexa closed 1 year ago

lexa commented 2 years ago

Fixes #85

If browse-at-remote is called on detached head or with browse-at-remote-prefer-symbolic set to nil, location is a commit hash. Which produces URLs like

https://stash.../browse/file.js?at=refs%2Fheads%2Fabcdef1234567890abcdef01234567890abcdef0#1

This URL is not recognised by stash. Stash expect the URL of format (note lack of 'refs%2Fheads'):

https://stash.../browse/file.js?at=abcdef1234567890abcdef01234567890abcdef0#1

Remove 'refs/heads' prefix frome the URL. That will also remove the prefix for branches and tags, but Stash works if the branch name specified without 'refs/heads'. For example both URLs produce the same result:

https://stash.../browse/file.js?at=BRANCH https://stash.../browse/file.js?at=refs%2Fheads%2FBRANCH

mstorus commented 1 year ago

Thanks @lexa, I tested this and it works for me too in Stash. @rmuslimov can we merge it?

rmuslimov commented 1 year ago

Thanks for adding and checking @mstorus @lexa