Parse git URLs in a more generic way instead of tight coupling against github.com
Fixes #3
Coverage remained the same at 9.649% when pulling c95fe89b0512374ebad5e2ebdc7b034804763ad4 on skymeyer:genericgit into b3920ba1acb5c1709b71e76034c05531b32205e6 on bramp:master.
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 ssh and https protocol it is assumed that both are served from the same hostname, so I think this generic approach should be ok.
Otherwise we can resort to creating a parser interface (supplying some defaults for github, bitbucket, gitlab, ...) and allowing injection in the redirectCreator for people having a more exotic use-case or private git servers from which we can't derive the parser from the remote URL.
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.