Skip to content

Conversation

@synthead
Copy link

Fixes #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 synthead changed the title Always assume origin is a GitHub instance Always assume origin is a GitHub instance (adds support for self-hosted GitHub Enterprise URLs) Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support site names other than github.com (i.e. for GitHub Enterprise)

1 participant