New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse git URLs in a more generic way instead of tight coupling against github.com #2
base: master
Are you sure you want to change the base?
Conversation
The reason it was specific to GitHub, is because I didn't think you could always assume the git and https URLs mapped like this. It seems to work for bitbucket, do you know if this mapping of URLs is part of a standard or spec? |
Just tested gitlab and that seems to work as well for me. The only spec I know of is what is described in https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols. If a git server implements both Otherwise we can resort to creating a parser interface (supplying some defaults for github, bitbucket, gitlab, ...) and allowing injection in the |
Thanks for researching this. Ok I'm happy with the current changes. If you wish to create a parsing/mapping interface feel free, or we could just defer that to later. |
I'd defer that to later yes if we have concrete short comings, I think we are good like it is for now. |
@@ -14,7 +14,7 @@ | |||
|
|||
// goredirects creates static HTML that redirects go packages hosted | |||
// on a vanity domain to GitHub. | |||
package main // import "bramp.net/goredirects" | |||
package main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be reverted
if len(matches) == 3 { | ||
return fmt.Sprintf("https://github.com/%s/%s.git", matches[1], matches[2]) | ||
// gitSSHtoHTTPS takes a URL to a SSH repo, and returns the equlivant HTTPS url. | ||
// If it is already a valid Git HTTPS URL just return it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth documenting the assumption we are making about the URL.
Fixes #3