mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
Added support for cnb.cool. (#217)
Co-authored-by: ericdduan <ericdduan@tencent.com>
This commit is contained in:
parent
2a66fcd7e3
commit
a223125abc
|
|
@ -128,6 +128,7 @@ git-open can automatically guess the corresponding repository page for remotes
|
|||
- Visual Studio Team Services
|
||||
- Team Foundation Server (on-premises)
|
||||
- AWS Code Commit
|
||||
- cnb.cool
|
||||
|
||||
## Configuration
|
||||
|
||||
|
|
|
|||
10
git-open
10
git-open
|
|
@ -246,8 +246,16 @@ elif [[ "$domain" =~ amazonaws\.com$ ]]; then
|
|||
# Replace branch ref.
|
||||
# Ex. /tree/foobar -> foobar/--/
|
||||
providerBranchRef="${providerBranchRef##*/}/--/"
|
||||
elif [[ "$domain" =~ cnb\.cool$ ]]; then
|
||||
# cnb.cool
|
||||
# Replace URL path.
|
||||
# Ex. repos/example -> repos/example/-
|
||||
urlpath="$urlpath/-"
|
||||
if [[ $remote_ref = "master" ]]; then
|
||||
# repos/example/tree/master -> repos/example/-/tree/master
|
||||
urlpath="$urlpath$providerBranchRef"
|
||||
fi
|
||||
fi
|
||||
|
||||
openurl="$protocol://$domain/$urlpath"
|
||||
|
||||
if (( is_commit )); then
|
||||
|
|
|
|||
|
|
@ -626,6 +626,30 @@ setup() {
|
|||
assert_output "Issue feature does not supported on AWS Code Commit."
|
||||
}
|
||||
|
||||
##
|
||||
## cnb.cool
|
||||
##
|
||||
|
||||
@test "cnb: https url" {
|
||||
git remote set-url origin "https://cnb.cool/repos/repo"
|
||||
git checkout -B "master"
|
||||
run ../git-open
|
||||
assert_output "https://cnb.cool/repos/repo/-/tree/master"
|
||||
}
|
||||
|
||||
@test "cnb: branch " {
|
||||
git remote set-url origin "https://cnb.cool/repos/repo"
|
||||
git checkout -B "mybranch"
|
||||
run ../git-open
|
||||
assert_output "https://cnb.cool/repos/repo/-/tree/mybranch"
|
||||
}
|
||||
|
||||
@test "cnb: issue" {
|
||||
git remote set-url origin "https://cnb.cool/repos/repo"
|
||||
git checkout -B "issues/10"
|
||||
run ../git-open "--issue"
|
||||
assert_output "https://cnb.cool/repos/repo/-/issues/10"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
cd ..
|
||||
|
|
|
|||
Loading…
Reference in a new issue