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
This will make `ssh://git@<host>:<port>/<user>/<repo>` URLs
intermediately look like `git@<host>:<user>/<repo>` and
expose these to further processing/substitution.
Properties required for proper working are:
* `gitopen.gitlab.domain`
* `gitopen.gitlab.ssh.port`
The username prefix ‘username@bitbucket.org/*’ caused a phishing error
on Safari which persisted across page visits on BitBucket, unless the
username was manually deleted from url.
* Add http protocol for Gitlab custom host
* default to https
* Revert "default to https"
This reverts commit b25190b5d1.
* Revert "Merge branch 'master' into http"
This reverts commit 18573f8b29, reversing
changes made to 88a9e254ae.
* Revert "Revert "Merge branch 'master' into http""
This reverts commit fa0e6d1f21.
* Revert "Revert "default to https""
This reverts commit d754476010.
In my ssh config if specified that all connections with github.com should use the `git` user. So when cloning a repo I can type:
```bash
git clone github.com:paulirish/git-open.git
```
instead of
```bash
git clone git@github.com:paulirish/git-open.git
```
This PR contains a fix for repos that have been cloned without specifying the `git` user.
You need to add another config option to remove the port, but this is now working for me. Could be improved by adding an option for the protocol as well, I'm using `http` instead of `https`, I've left that as is for now though.