Commit graph

93 commits

Author SHA1 Message Date
Víctor ad8fac9309
Detect WSL case insensitively
My `uname -r` is `4.19.81-microsoft-standard`
2019-11-26 10:54:37 +01:00
Dinesh 8b909f81dc Add suffix flag
Co-authored-by: Sowmiya <sowmiyamuthuraman@gmail.com>
2019-09-07 23:08:13 +05:30
Domenico Gemoli 0564817aef Adding a --commit option.
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.
2019-07-08 23:34:13 +02:00
Arunvel Sriram 8239d0a785 Add option to print the url 2019-07-03 21:32:34 +05:30
Love F 3d1ad212b2 default to upstream branch 2019-06-02 14:24:41 +02:00
Bjorn Neergaard 96c80ffe80 Remove openopt, allow spaces in $BROWSER
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.
2018-11-21 14:01:33 -07:00
Orestis Floros 8c8c41bd50
Support opening current tag / commit
Fixes #89.
Fixes #129.
2018-09-14 05:28:58 +03:00
Y.Tsuji 6bb49c28c5 Fix Indentation. 2018-08-13 01:55:43 +09:00
Yohei TSUJI 2ef17f07d8 Added test cases for AWS Code Commit. 2018-08-10 15:56:21 +09:00
Yohei TSUJI 557fd40b1c Added support for AWS Code commit. 2018-08-08 13:58:57 +09:00
Dave Wikoff 995e91591f Swap uppercase/lowercase for ssh feature (#123) 2018-04-29 17:31:30 -07:00
Dave Wikoff 895240ff03 Fix issue #121 - incompatability with bash < 4 2018-04-27 10:19:56 -04:00
Dave Wikoff d049d441b3
Merge pull request #114 from Jaxwood/master
Fix bug with open -i on default VSTS project repo
2018-02-21 20:37:32 -05:00
Jacob Lorenzen aea6e3edb7
Add comment on default VSTS repository urls 2018-02-20 18:20:01 +01:00
August Valera 775361b509 Fix shellcheck 2018-02-15 22:23:37 -08:00
August Valera 8909a2b753 Adds support for sshconfig expansion
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.
2018-02-04 12:12:48 -08:00
Dave Wikoff 7449bfa7e1
Merge pull request #115 from larsks/feature/ls-url
Use ls-remote --get-url to get remote url
2018-02-04 12:06:54 -05:00
Lars Kellogg-Stedman 740222babf Use ls-remote --get-url to get remote url
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.
2018-02-02 10:41:54 -05:00
Jacob Lorenzen 67b72ac0f2 Fix bug with open -i on default VSTS project repo
The default VSTS clone url is different from other project repository urls

e.g. Default repository url: https://gitopen.visualstudio.com/_git/Project
     Sibling repository url: https://gitopen.visualstudio.com/Project/_git/Repository

     Trying to use git open -i on the default repository will lead to an
     url formatted as https://gitopen.visualstudio.com/_git/Project/_workitems?id=xx
     This url is malformed as the _git part should not be part of it.

     This change will fix this bug and correctly format url as
     https://gitopen.visualstudio.com/Project/_workitems?id=xx.
2018-01-24 13:41:02 +01:00
Nils Winkler 119ada7f69 Removed an unnecessary if statement 2018-01-10 07:53:44 +01:00
Nils Winkler 24dd2fc5fc Added support for Bitbucket Server with different root context
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.
2018-01-09 09:21:01 +01:00
Frank Fesevur 734517991a Update support for open.default.remote config (#79) 2017-12-01 13:41:32 -08:00
Frank Fesevur d97b7f36aa Fix BATS testing on WSL (#104)
The $openopt resulted in unexpected results during testing
2017-12-01 12:30:50 -08:00
Paul Irish 3a423e11a6
allow command to be run in git repo subdirectory (#105) 2017-12-01 12:18:07 -08:00
Edward Thomson e3ce014bfa Add support for Visual Studio Team Services and Team Foundation Server (#93)
* 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
2017-11-30 16:23:52 -08:00
Love F 363d054386 Git styled -h and --issue options (#94) 2017-10-31 16:15:50 -07:00
Frank Fesevur 80cb34169a Add support for WSL (#101) 2017-10-30 16:28:39 -07:00
Paul Irish fa49deeb17
default to tracked remote (#88) 2017-10-27 13:56:29 -07:00
Dave Wikoff e68eee6a44 Strip ports based on protocol properly. Adding config for custom domains and protocols. (#92) 2017-10-26 12:52:33 -07:00
Frank Fesevur 3be1c00f36 Fix opening final URL on MSYS (#91) 2017-06-23 13:49:00 -07:00
Paul Irish c9ba476e71 fix shellcheck failure https://github.com/koalaman/shellcheck/wiki/SC2004 2017-06-21 10:19:31 -07:00
Dave Wikoff 79501d6f11 Add issues support 2017-06-20 18:02:52 -07:00
Dave Wikoff c2c7830514 Bitbucket server, and minor tweaks to BROWSER 2017-06-18 16:52:12 -07:00
Paul Irish 9e9fee04de import revised git-open from @dermagia
62e17bfcb9/config/zsh/bin/git-open
2017-06-18 13:51:53 -07:00
Paul Irish 927517adb9 Add a test suite (#78) 2017-06-16 15:57:49 -07:00
Andreas Schoeneck ac027a8d00 Normalize ssh+port URLs to match default style
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`
2017-06-12 12:56:31 +02:00
Frank Fesevur 054772bed6 Fix trailing spaces
CI checks because of it
Leftover of #63
2017-06-01 13:01:34 +02:00
Frank Fesevur cf2c289692 Merge pull request #63 from freekmurze/master
Handle GitHub urls without the git user
2017-05-31 20:55:35 +02:00
Paul Irish 92dc862c02 correct shellcheck issues. 2017-05-29 12:41:01 -07:00
Paul Irish 75c61f13e6 Add eclint to assert editorconfig settings (#72) 2017-05-29 12:34:10 -07:00
Trent Rand 176f1b8f96 Remove username from <giturl> for BitBucket (#69)
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.
2017-05-26 19:16:03 -07:00
Martin Delille 4e3aa0ad51 Add http protocol for Gitlab custom host (#60)
* 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.
2017-02-10 09:13:47 -08:00
Freek Van der Herten e7dc5562b7 Handle GitHub urls without the git user
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.
2017-01-04 16:03:51 +01:00
Paul Irish 197648315b Merge pull request #56 from elim/feature/separate-url-gitlab
Supports separate URLs in the repo and the web
2017-01-03 16:19:24 -08:00
Takeru Naito 7ac4f71f42
Change the option names for GitLab 2016-11-19 23:03:57 +09:00
b4b4r07 cb4d833644 Replace exit 0 with exit $? 2016-11-13 01:51:40 +09:00
Takeru Naito 1808e612c5
Supports separate URLs in the repo and the web
On a GitLab server.

ex.
---

repo: git@git.example.com:namespace/project.git
web:  https://gitlab.example.com/namespace/project

$ git config gitopen.gitlab.domain gitlab.example.com
$ git config gitopen.gitlab.ssh-domain git.example.com
$ git open
2016-11-04 19:03:51 +09:00
Frank Fesevur 36f9a77956 Handle GitLab's default SSH notation
On GitLab the default SSH style is like git@gitlab.example.com:user/repo
Now it recognizes this format as well on your own GitLab installation.
2016-10-27 14:01:14 +02:00
Paul Irish 485bb31427 Merge pull request #51 from evoactivity/patch-1
Handle gitlab using SSH remote URL
2016-08-15 19:39:55 -07:00
Paul Irish afd7fee2b2 Merge pull request #49 from neoascetic/patch-1
Fix gist opening
2016-08-15 19:26:09 -07:00