From 3134e9b0c28cf0809395131a95957287ba008ad5 Mon Sep 17 00:00:00 2001 From: Katrina Verey Date: Tue, 10 Jan 2023 16:14:54 -0500 Subject: [PATCH] Better SCP colon-must-be-after-slash test --- api/internal/git/repospec_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/api/internal/git/repospec_test.go b/api/internal/git/repospec_test.go index 6d8c6568c..84a878164 100644 --- a/api/internal/git/repospec_test.go +++ b/api/internal/git/repospec_test.go @@ -92,10 +92,6 @@ func TestNewRepoSpecFromUrlErrors(t *testing.T) { "htxxxtp://github.com/", "url lacks host", }, - "bad_scp": { - "git@local/path:file/system", - "url lacks repoPath", - }, "no_org_repo": { "ssh://git.example.com", "url lacks repoPath", @@ -588,6 +584,18 @@ func TestNewRepoSpecFromUrl_Smoke(t *testing.T) { GitSuffix: ".git", }, }, + { + name: "colon behind slash not scp delimiter", + input: "git@gitlab.com/user:name/YOUR-REPOSITORY.git/path", + cloneSpec: "git@gitlab.com/user:name/YOUR-REPOSITORY.git", + absPath: notCloned.Join("path"), + repoSpec: RepoSpec{ + Host: "git@gitlab.com/", + RepoPath: "user:name/YOUR-REPOSITORY", + KustRootPath: "path", + GitSuffix: ".git", + }, + }, } for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) {