File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ git-open can automatically guess the corresponding repository page for remotes
101101- Atlassian Bitbucket Server (formerly _Atlassian Stash_)
102102- Visual Studio Team Services
103103- Team Foundation Server (on-premises)
104+ - AWS Code Commit
104105
105106## Configuration
106107
Original file line number Diff line number Diff line change @@ -196,6 +196,28 @@ elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git'
196196 # Keep project and repository name, append branch selector.
197197 providerBranchRef=" ?version=GB$branch "
198198 fi
199+ elif [[ " $domain " =~ amazonaws\. com$ ]]; then
200+ # AWS Code Commit
201+ if (( is_issue )) ; then
202+ echo " Issue feature does not supported on AWS Code Commit." 1>&2
203+ exit 1
204+ fi
205+
206+ # Take region name from domain.
207+ region=${domain#* .}
208+ region=${region%% .* }
209+
210+ # Replace domain.
211+ # Ex. git-codecommit.us-east-1.amazonaws.com -> us-east-1.console.aws.amazon.com
212+ domain=" ${region} .console.aws.amazon.com"
213+
214+ # Replace URL path.
215+ # Ex. v1/repos/example -> codecommit/home?region=us-east-1#/repository/example/browse/
216+ urlpath=" codecommit/home?region=${region} #/repository/${urlpath##*/ } /browse/"
217+
218+ # Replace branch ref.
219+ # Ex. /tree/foobar -> foobar/--/
220+ providerBranchRef=" ${providerBranchRef##*/ } /--/"
199221fi
200222
201223openurl=" $protocol ://$domain /$urlpath "
Original file line number Diff line number Diff line change @@ -503,6 +503,39 @@ setup() {
503503 assert_output " https://gitopen.visualstudio.com/Project/_workitems?id=36"
504504}
505505
506+ # #
507+ # # AWS Code Commit
508+ # #
509+
510+ @test " aws: https url" {
511+ git remote set-url origin " https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
512+ git checkout -B " master"
513+ run ../git-open
514+ assert_output " https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/"
515+ }
516+
517+ @test " aws: ssh url" {
518+ git remote set-url origin " ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
519+ git checkout -B " master"
520+ run ../git-open
521+ assert_output " https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/"
522+ }
523+
524+ @test " aws: branch " {
525+ git remote set-url origin " https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
526+ git checkout -B " mybranch"
527+ run ../git-open
528+ assert_output " https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/mybranch/--/"
529+ }
530+
531+ @test " aws: issue" {
532+ git remote set-url origin " https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
533+ git checkout -B " issues/#12"
534+ run ../git-open " --issue"
535+ [ " $status " -eq 1 ]
536+ assert_output " Issue feature does not supported on AWS Code Commit."
537+ }
538+
506539
507540teardown () {
508541 cd ..
You can’t perform that action at this time.
0 commit comments