mirror of
https://github.com/paulirish/git-open.git
synced 2026-09-10 07:26:15 -04:00
Merge pull request #128 from crossroad0201/master
Supports AWS Code Commit.
This commit is contained in:
commit
5fefffede3
|
|
@ -101,6 +101,7 @@ git-open can automatically guess the corresponding repository page for remotes
|
|||
- Atlassian Bitbucket Server (formerly _Atlassian Stash_)
|
||||
- Visual Studio Team Services
|
||||
- Team Foundation Server (on-premises)
|
||||
- AWS Code Commit
|
||||
|
||||
## Configuration
|
||||
|
||||
|
|
|
|||
22
git-open
22
git-open
|
|
@ -196,6 +196,28 @@ elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git'
|
|||
# Keep project and repository name, append branch selector.
|
||||
providerBranchRef="?version=GB$branch"
|
||||
fi
|
||||
elif [[ "$domain" =~ amazonaws\.com$ ]]; then
|
||||
# AWS Code Commit
|
||||
if (( is_issue )); then
|
||||
echo "Issue feature does not supported on AWS Code Commit." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Take region name from domain.
|
||||
region=${domain#*.}
|
||||
region=${region%%.*}
|
||||
|
||||
# Replace domain.
|
||||
# Ex. git-codecommit.us-east-1.amazonaws.com -> us-east-1.console.aws.amazon.com
|
||||
domain="${region}.console.aws.amazon.com"
|
||||
|
||||
# Replace URL path.
|
||||
# Ex. v1/repos/example -> codecommit/home?region=us-east-1#/repository/example/browse/
|
||||
urlpath="codecommit/home?region=${region}#/repository/${urlpath##*/}/browse/"
|
||||
|
||||
# Replace branch ref.
|
||||
# Ex. /tree/foobar -> foobar/--/
|
||||
providerBranchRef="${providerBranchRef##*/}/--/"
|
||||
fi
|
||||
|
||||
openurl="$protocol://$domain/$urlpath"
|
||||
|
|
|
|||
|
|
@ -503,6 +503,39 @@ setup() {
|
|||
assert_output "https://gitopen.visualstudio.com/Project/_workitems?id=36"
|
||||
}
|
||||
|
||||
##
|
||||
## AWS Code Commit
|
||||
##
|
||||
|
||||
@test "aws: https url" {
|
||||
git remote set-url origin "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
|
||||
git checkout -B "master"
|
||||
run ../git-open
|
||||
assert_output "https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/"
|
||||
}
|
||||
|
||||
@test "aws: ssh url" {
|
||||
git remote set-url origin "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
|
||||
git checkout -B "master"
|
||||
run ../git-open
|
||||
assert_output "https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/"
|
||||
}
|
||||
|
||||
@test "aws: branch " {
|
||||
git remote set-url origin "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
|
||||
git checkout -B "mybranch"
|
||||
run ../git-open
|
||||
assert_output "https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/mybranch/--/"
|
||||
}
|
||||
|
||||
@test "aws: issue" {
|
||||
git remote set-url origin "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
|
||||
git checkout -B "issues/#12"
|
||||
run ../git-open "--issue"
|
||||
[ "$status" -eq 1 ]
|
||||
assert_output "Issue feature does not supported on AWS Code Commit."
|
||||
}
|
||||
|
||||
|
||||
teardown() {
|
||||
cd ..
|
||||
|
|
|
|||
Loading…
Reference in a new issue