Merge pull request #1 from crossroad0201/supports_aws_code_commit

Added support for AWS Code commit.
This commit is contained in:
Yohei TSUJI 2018-08-08 14:20:13 +09:00 committed by GitHub
commit c68b9c16e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -196,6 +196,23 @@ 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
# 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"