diff --git a/taskfile/node.go b/taskfile/node.go index ecf23aeb..b02b9a16 100644 --- a/taskfile/node.go +++ b/taskfile/node.go @@ -2,6 +2,7 @@ package taskfile import ( "context" + "slices" "strings" "time" @@ -89,7 +90,10 @@ func getScheme(uri string) (string, error) { return "", err } - if strings.HasSuffix(strings.Split(u.Path, "//")[0], ".git") && (u.Scheme == "git" || u.Scheme == "ssh" || u.Scheme == "https" || u.Scheme == "http") { + isDotGit := strings.HasSuffix(strings.Split(u.Path, "//")[0], ".git") + isUnderscoreGit := strings.Contains(strings.Split(u.Path, "//")[0], "/_git/") + schemeIsGitCompatible := slices.Contains([]string{"git", "ssh", "https", "http"}, u.Scheme) + if (isDotGit || isUnderscoreGit) && schemeIsGitCompatible { return "git", nil } diff --git a/taskfile/node_test.go b/taskfile/node_test.go index c125945d..b775c4a0 100644 --- a/taskfile/node_test.go +++ b/taskfile/node_test.go @@ -21,4 +21,7 @@ func TestScheme(t *testing.T) { scheme, err = getScheme("https://github.com/foo/common.yml") assert.NoError(t, err) assert.Equal(t, "https", scheme) + scheme, err = getScheme("https://some-azure-host.com/org/project/_git/repo") + assert.NoError(t, err) + assert.Equal(t, "git", scheme) }