vim-to-github icon indicating copy to clipboard operation
vim-to-github copied to clipboard

Always assume origin is a GitHub instance (adds support for self-hosted GitHub Enterprise URLs)

Open synthead opened this issue 2 years ago • 0 comments

Fixes https://github.com/tonchis/vim-to-github/issues/18!

This PR assumes that the origin repo is always a GitHub instance, which adds compatibility for company-hosted GitHub Enterprise instances with a different site name. This replaces the hard-coded github.com in the regex and https://github.com in the URL output with an additional sed command to capture the site name and reuse it in the URL.

For example, with an upstream origin URL of...

[email protected]:example-org/example-repo.git

...this PR would produce this URL for a few lines on README.md:

https://github.mycompany.com/example-org/example-repo/blob/caf758b2dbe03480dd340dd339379ca86797e6b6/README.md#L11-L27

Prior to this PR, a URL like this is produced:

https://github.com///blob/caf758b2dbe03480dd340dd339379ca86797e6b6/README.md#L11-L27

synthead avatar Aug 10 '23 20:08 synthead