mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
fix(git): add support for parsing weirder remote URLs
This commit is contained in:
parent
3f6addab2a
commit
c455fb07f2
2 changed files with 16 additions and 2 deletions
|
@ -32,10 +32,19 @@ func TestFindGitSlug(t *testing.T) {
|
|||
{"http://github.com/nektos/act", "GitHub", "nektos/act"},
|
||||
{"git+ssh://git@github.com/owner/repo.git", "GitHub", "owner/repo"},
|
||||
{"http://myotherrepo.com/act.git", "", "http://myotherrepo.com/act.git"},
|
||||
{"ssh://git@example.com/forgejo/act.git", "GitHubEnterprise", "forgejo/act"},
|
||||
{"ssh://git@example.com:2222/forgejo/act.git", "GitHubEnterprise", "forgejo/act"},
|
||||
{"ssh://git@example.com:forgejo/act.git", "GitHubEnterprise", "forgejo/act"},
|
||||
{"ssh://git@example.com:/forgejo/act.git", "GitHubEnterprise", "forgejo/act"},
|
||||
}
|
||||
|
||||
for _, tt := range slugTests {
|
||||
provider, slug, err := findGitSlug(tt.url, "github.com")
|
||||
instance := "example.com"
|
||||
if tt.provider == "GitHub" {
|
||||
instance = "github.com"
|
||||
}
|
||||
|
||||
provider, slug, err := findGitSlug(tt.url, instance)
|
||||
|
||||
assert.NoError(err)
|
||||
assert.Equal(tt.provider, provider)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue