mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-12 08:00:05 +01:00
feat: subgroups (#91)
Several code-hosters like GitLab allow to have subgroups. These were previously not suppported because we weren't able to tell if something was a subgroup or a subdir. By letting users specify the `.git` part of the http string as well, this now work for all protocol, including https.
This commit is contained in:
parent
cd5e2945d2
commit
74a7f9775e
2 changed files with 39 additions and 1 deletions
|
|
@ -106,7 +106,8 @@ const (
|
|||
gitSSHExp = `ssh://git@(?P<host>.+)/(?P<user>.+)/(?P<repo>.+).git`
|
||||
gitSCPExp = `^git@(?P<host>.+):(?P<user>.+)/(?P<repo>.+).git`
|
||||
// The long ugly pattern for ${host} here is a generic pattern for "valid URL with zero or more subdomains and a valid TLD"
|
||||
gitHTTPSExp = `(?P<host>[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/(?P<user>[-_a-zA-Z0-9]+)/(?P<repo>[-_a-zA-Z0-9]+)`
|
||||
gitHTTPSSubgroup = `(?P<host>[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/(?P<user>[-_a-zA-Z0-9/]+)/(?P<repo>[-_a-zA-Z0-9]+)\.git`
|
||||
gitHTTPSExp = `(?P<host>[a-zA-Z0-9][a-zA-Z0-9-\.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/(?P<user>[-_a-zA-Z0-9]+)/(?P<repo>[-_a-zA-Z0-9]+)`
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -130,6 +131,9 @@ func parseGit(uri string) *Dependency {
|
|||
case reMatch(gitSCPExp, uri):
|
||||
gs, version = match(uri, gitSCPExp)
|
||||
gs.Scheme = GitSchemeSSH
|
||||
case reMatch(gitHTTPSSubgroup, uri):
|
||||
gs, version = match(uri, gitHTTPSSubgroup)
|
||||
gs.Scheme = GitSchemeHTTPS
|
||||
case reMatch(gitHTTPSExp, uri):
|
||||
gs, version = match(uri, gitHTTPSExp)
|
||||
gs.Scheme = GitSchemeHTTPS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue