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:
Dominik Süß 2020-03-17 17:45:34 +01:00 committed by GitHub
parent cd5e2945d2
commit 74a7f9775e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 1 deletions

View file

@ -169,6 +169,40 @@ func TestParseGit(t *testing.T) {
},
wantRemote: "https://git.example.com/foo/bar",
},
{
name: "ValidGitSubgroups",
uri: "example.com/group/subgroup/repository.git",
want: &Dependency{
Version: "master",
Source: Source{
GitSource: &Git{
Scheme: GitSchemeHTTPS,
Host: "example.com",
User: "group/subgroup",
Repo: "repository",
Subdir: "",
},
},
},
wantRemote: "https://example.com/group/subgroup/repository",
},
{
name: "ValidGitSubgroupSubDir",
uri: "example.com/group/subgroup/repository.git/subdir",
want: &Dependency{
Version: "master",
Source: Source{
GitSource: &Git{
Scheme: GitSchemeHTTPS,
Host: "example.com",
User: "group/subgroup",
Repo: "repository",
Subdir: "/subdir",
},
},
},
wantRemote: "https://example.com/group/subgroup/repository",
},
}
for _, c := range tests {