mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-12 16:10:04 +01:00
feat: generic git https (#73)
Previously, only `github.com` was supported for HTTP cloning of packages. With this change, every git host using the http protocol (GitHub, Gitlab, Gitea) is supported :D
This commit is contained in:
parent
8f14d63f95
commit
0ba0ff5522
4 changed files with 127 additions and 19 deletions
|
|
@ -67,6 +67,108 @@ func TestParseGit(t *testing.T) {
|
|||
want: sshWant("my.host"),
|
||||
wantRemote: "ssh://git@my.host/user/repo.git", // want ssh format here
|
||||
},
|
||||
{
|
||||
name: "ValidGitHTTPS",
|
||||
uri: "https://example.com/foo/bar",
|
||||
want: &Dependency{
|
||||
Version: "master",
|
||||
Source: Source{
|
||||
GitSource: &Git{
|
||||
Scheme: GitSchemeHTTPS,
|
||||
Host: "example.com",
|
||||
User: "foo",
|
||||
Repo: "bar",
|
||||
Subdir: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
wantRemote: "https://example.com/foo/bar",
|
||||
},
|
||||
{
|
||||
name: "ValidGitNoScheme",
|
||||
uri: "example.com/foo/bar",
|
||||
want: &Dependency{
|
||||
Version: "master",
|
||||
Source: Source{
|
||||
GitSource: &Git{
|
||||
Scheme: GitSchemeHTTPS,
|
||||
Host: "example.com",
|
||||
User: "foo",
|
||||
Repo: "bar",
|
||||
Subdir: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
wantRemote: "https://example.com/foo/bar",
|
||||
},
|
||||
{
|
||||
name: "ValidGitPath",
|
||||
uri: "example.com/foo/bar/baz/bat",
|
||||
want: &Dependency{
|
||||
Version: "master",
|
||||
Source: Source{
|
||||
GitSource: &Git{
|
||||
Scheme: GitSchemeHTTPS,
|
||||
Host: "example.com",
|
||||
User: "foo",
|
||||
Repo: "bar",
|
||||
Subdir: "/baz/bat",
|
||||
},
|
||||
},
|
||||
},
|
||||
wantRemote: "https://example.com/foo/bar",
|
||||
},
|
||||
{
|
||||
name: "ValidGitVersion",
|
||||
uri: "example.com/foo/bar@baz",
|
||||
want: &Dependency{
|
||||
Version: "baz",
|
||||
Source: Source{
|
||||
GitSource: &Git{
|
||||
Scheme: GitSchemeHTTPS,
|
||||
Host: "example.com",
|
||||
User: "foo",
|
||||
Repo: "bar",
|
||||
Subdir: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
wantRemote: "https://example.com/foo/bar",
|
||||
},
|
||||
{
|
||||
name: "ValidGitPathVersion",
|
||||
uri: "example.com/foo/bar/baz@bat",
|
||||
want: &Dependency{
|
||||
Version: "bat",
|
||||
Source: Source{
|
||||
GitSource: &Git{
|
||||
Scheme: GitSchemeHTTPS,
|
||||
Host: "example.com",
|
||||
User: "foo",
|
||||
Repo: "bar",
|
||||
Subdir: "/baz",
|
||||
},
|
||||
},
|
||||
},
|
||||
wantRemote: "https://example.com/foo/bar",
|
||||
},
|
||||
{
|
||||
name: "ValidGitSubdomain",
|
||||
uri: "git.example.com/foo/bar",
|
||||
want: &Dependency{
|
||||
Version: "master",
|
||||
Source: Source{
|
||||
GitSource: &Git{
|
||||
Scheme: GitSchemeHTTPS,
|
||||
Host: "git.example.com",
|
||||
User: "foo",
|
||||
Repo: "bar",
|
||||
Subdir: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
wantRemote: "https://git.example.com/foo/bar",
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue