mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
parent
5fefffede3
commit
8c8c41bd50
4
git-open
4
git-open
|
|
@ -153,8 +153,8 @@ function getConfig() {
|
|||
domain=$(getConfig "domain")
|
||||
protocol=$(getConfig "protocol")
|
||||
|
||||
# Get current branch
|
||||
branch=${2:-$(git symbolic-ref -q --short HEAD)}
|
||||
# Get current branch / tag / commit
|
||||
branch=${2:-$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match 2>/dev/null || git rev-parse HEAD)}
|
||||
|
||||
# Split arguments on '/'
|
||||
IFS='/' read -r -a pathargs <<<"$urlpath"
|
||||
|
|
|
|||
|
|
@ -65,6 +65,17 @@ setup() {
|
|||
assert_output "https://github.com/user/repo/tree/mybranch"
|
||||
}
|
||||
|
||||
@test "gh: tag" {
|
||||
git remote set-url origin "git@github.com:user/repo.git"
|
||||
git tag mytag
|
||||
echo a > a
|
||||
git add a
|
||||
git commit -m a
|
||||
git checkout mytag
|
||||
run ../git-open
|
||||
assert_output "https://github.com/user/repo/tree/mytag"
|
||||
}
|
||||
|
||||
@test "gh: non-origin remote" {
|
||||
git remote set-url origin "git@github.com:user/repo.git"
|
||||
git remote add upstream "git@github.com:upstreamorg/repo.git"
|
||||
|
|
@ -292,6 +303,17 @@ setup() {
|
|||
assert_output --partial "https://bitbucket.org/paulirish/crbug-extension"
|
||||
}
|
||||
|
||||
@test "bitbucket: tag" {
|
||||
git remote set-url origin "git@bitbucket.org:paulirish/crbug-extension.git"
|
||||
git tag mytag
|
||||
echo a > a
|
||||
git add a
|
||||
git commit -m a
|
||||
git checkout mytag
|
||||
run ../git-open
|
||||
assert_output "https://bitbucket.org/paulirish/crbug-extension/src?at=mytag"
|
||||
}
|
||||
|
||||
@test "bitbucket: non-origin remote" {
|
||||
# https://github.com/paulirish/git-open/pull/4
|
||||
git remote add bbclone "git@bitbucket.org:rwhitbeck/git-open.git"
|
||||
|
|
|
|||
Loading…
Reference in a new issue