ben-gibson / GitLink

A Jetbrains plugin that opens a local file under Git version control in its remote host using the default browser.
https://plugins.jetbrains.com/plugin/8183-gitlink
MIT License
671 stars 58 forks source link

Not working with BitBucket Server #264

Open cjoecker opened 1 year ago

cjoecker commented 1 year ago

Hi, The URLs I'm getting for Bitbucket Server are not correct in my case.

Correct URL: https://my-url.com/stash/projects/evr/repos/repo-name/browse/README.md

Wrong URL generated by Gitlink: https://my-url.com/projects/evr/repos/repo-name/browse/README.md

Remote URL: ssh://git@my-url.com:1234/evr/repo-name.git

The part /stash is added to the online URL.

As a possible solution would be, to allow to adapt the base-URL on the settings of the plugin. Some input box where I can write https://my-url.com/stash/

marbon87 commented 1 year ago

I have the same problem. A workaround is to configure a custom plattform based on the templates in https://github.com/ben-gibson/GitLink/blob/5ed78be39d9158b42d4b6ba8bae3acf0578930d5/src/main/kotlin/uk/co/ben_gibson/git/link/url/template/UrlTemplates.kt#L29-L35

and register your private domain for the custom plattform in Domain Registry

cjoecker commented 1 year ago

@marbon87 thanks for the hint! I would still prefer it to be fixed since that’s a lot of work

eXpl0it3r commented 1 year ago

I adjusted them as following:

{remote:url:protocol}://{remote:url:host}/projects/{remote:url:path:1}/repos/{remote:url:path:2}/browse/{file:path}/{file:name}?at=refs/heads/{branch}{line-block:start}#{line:start}-{line:end}{line-block:end}
{remote:url:protocol}://{remote:url:host}/projects/{remote:url:path:1}/repos/{remote:url:path:2}/browse/{file:path}/{file:name}?at={commit}{line-block:start}#{line:start}-{line:end}{line-block:end}
{remote:url:protocol}://{remote:url:host}/projects/{remote:url:path:1}/repos/{remote:url:path:2}/commits/{commit}

As the remote was more like https://bitbucket.example.com/scm/project/repo.git