diff --git a/spec/v1/deps/git.go b/spec/v1/deps/git.go index 862b20a..c3bbcd3 100644 --- a/spec/v1/deps/git.go +++ b/spec/v1/deps/git.go @@ -106,8 +106,8 @@ const ( gitSSHExp = `ssh://git@(?P.+)/(?P.+)/(?P.+).git` gitSCPExp = `^git@(?P.+):(?P.+)/(?P.+).git` // The long ugly pattern for ${host} here is a generic pattern for "valid URL with zero or more subdomains and a valid TLD" - gitHTTPSSubgroup = `(?P[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/(?P[-_a-zA-Z0-9/\.]+)/(?P[-_a-zA-Z0-9\.]+)\.git` - gitHTTPSExp = `(?P[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/(?P[-_a-zA-Z0-9\.]+)/(?P[-_a-zA-Z0-9\.]+)` + gitHTTPSSubgroup = `(?P[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/(?P[-_~a-zA-Z0-9/\.]+)/(?P[-_a-zA-Z0-9\.]+)\.git` + gitHTTPSExp = `(?P[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/(?P[-_~a-zA-Z0-9\.]+)/(?P[-_a-zA-Z0-9\.]+)` ) var ( diff --git a/spec/v1/deps/git_test.go b/spec/v1/deps/git_test.go index 969726f..029a280 100644 --- a/spec/v1/deps/git_test.go +++ b/spec/v1/deps/git_test.go @@ -220,6 +220,23 @@ func TestParseGit(t *testing.T) { }, wantRemote: "https://example.com/group/subgroup/repository.git", }, + { + name: "ValidBitbucketPersonalRepository", + uri: "bitbucket.org/~user/repository.git", + want: &Dependency{ + Version: "master", + Source: Source{ + GitSource: &Git{ + Scheme: GitSchemeHTTPS, + Host: "bitbucket.org", + User: "~user", + Repo: "repository", + Subdir: "", + }, + }, + }, + wantRemote: "https://bitbucket.org/~user/repository.git", + }, } for _, c := range tests {