I've only tested this with gitlab seeing as I needed it there. If this could be useful I can integrate any feedback you might have to get this proposal merged.
Remove the openopt variable, instead opting to allow spaces in `$BROWSER`.
`$BROWSER` as used by the XDG implementation allows spaces (and `%s`
printf-style formatting strings), and is actually a PATH-style list.
While this patch doesn't make git-open compliant with the XDG-style
variable, it does allow for the use of `BROWSER="powershell.exe
Start"` in the environment.
See `man ssh_config` for documentation for sshconfig.
Only works on SCP-like remote URL's [user@]hostalias:path/to/repo.git
Parses through ~/.ssh/config, looking for a Host entry matching
hostalias (bash-like pattern matching supported) and expanding it to the
corresponding HostName entry, if applicable.
As noted in a comment, 'git ls-remote --get-url' will expand insteadOf
mappings. I use a number of shortcuts (like gh: for git on github,
lp: for git on launchpad, me: for my github repositories, etc), so I
was constantly hitting situations in which git-open would fail to do
the right thing.
It looks like '--get-url' has been available since git 2.12.0.
Please see the unit tests for more details. Basically, take the context
parts before 'scm' and add them to the new URL before the other parts.
Instead of taking fixed indexes for the path elements, base everything
off the index of the found 'scm' path element.
* Parse remotes as URLs or SCP-style paths
Instead of trying to strip on ':' and '/' to simplify a URL, actually
switch based on whether the remote path is a URL ("scheme://host:port/path")
or an SCP-style path (user@host:path) and parse them separately.
This allows us to handle custom ports in HTTP and HTTPS, but ignore
custom ports in an SSH url and HTTP remotes, instead of always upgrading
them to HTTPS.
* Introduce tests for Visual Studio Team Services
Add tests for Visual Studio Team Services (VSTS) and Team Foundation
Server (TFS). VSTS suggests remote paths in two formats: HTTPS URLs
or SSH URLs (including port number). TFS is an on-premises product
which - when running as an HTTP endpoint - defaults to port 8080.
* Branch selection in Visual Studio Team Services
VSTS and TFS URLs end in '/_git/RepositoryName` (with 0 or more leading
folders of hierarchy in front of that.) Detect these from the `_git` in
the penultimate folder of the path. Append branch information to VSTS
and TFS URLs.
Since VSTS and TFS use a query string to select a branch, instead of
including it in the server path, the `providerBranchRef` for other
services was changed to include the leading `/`, and now the `openurl`
and `providerBranchRef` are simply concatenated, to avoid an incorrect
trailing `/` for the VSTS and TFS branch URLs.
* Issues for Visual Studio Team Services
Provide issue support for VSTS and TFS, modifying the URL from the
`_git` endpoint to the `_workitems` endpoint and appending the `id`
query string.
* README: add VSTS and TFS support