Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion git-open
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions test/git-open.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down