(uri string)
| 85 | } |
| 86 | |
| 87 | func getScheme(uri string) (string, error) { |
| 88 | u, err := giturls.Parse(uri) |
| 89 | if u == nil { |
| 90 | return "", err |
| 91 | } |
| 92 | |
| 93 | isDotGit := strings.HasSuffix(strings.Split(u.Path, "//")[0], ".git") |
| 94 | isUnderscoreGit := strings.Contains(strings.Split(u.Path, "//")[0], "/_git/") |
| 95 | schemeIsGitCompatible := slices.Contains([]string{"git", "ssh", "https", "http"}, u.Scheme) |
| 96 | if (isDotGit || isUnderscoreGit) && schemeIsGitCompatible { |
| 97 | return "git", nil |
| 98 | } |
| 99 | |
| 100 | if before, _, ok := strings.Cut(uri, "://"); ok { |
| 101 | return before, nil |
| 102 | } |
| 103 | |
| 104 | return "", nil |
| 105 | } |
no outgoing calls
searching dependent graphs…