Allow file paths that look like usernames

This commit is contained in:
Katrina Verey
2023-01-09 17:15:40 -05:00
parent ddf14ea688
commit 240282fc6f
2 changed files with 22 additions and 8 deletions

View File

@@ -128,10 +128,6 @@ func TestNewRepoSpecFromUrlErrors(t *testing.T) {
"https://git@foo.com/path/to/repo",
"url lacks host",
},
"username unsupported with file": {
"file://git@/path/to/repo",
"url lacks repoPath",
},
}
for name, testCase := range badData {
@@ -512,6 +508,19 @@ func TestNewRepoSpecFromUrl_Smoke(t *testing.T) {
GitSuffix: ".git",
},
},
{
name: "username-like filepath with file protocol",
input: "file://git@home/path/to/repository.git//path?ref=branch",
cloneSpec: "file://git@home/path/to/repository.git",
absPath: notCloned.Join("path"),
repoSpec: RepoSpec{
Host: "file://",
RepoPath: "git@home/path/to/repository",
KustRootPath: "/path",
Ref: "branch",
GitSuffix: ".git",
},
},
{
name: "unsupported protocol after username (invalid and will be rejected by git)",
input: "git@scp://github.com/org/repo.git//path",