isSSHURL checks if the given URL is an SSH URL. SSH URLs can be in formats: - ssh://user@host/path - git@host:path - ssh://git@host/path
(url string)
| 150 | // - git@host:path |
| 151 | // - ssh://git@host/path |
| 152 | func isSSHURL(url string) bool { |
| 153 | url = strings.TrimSpace(url) |
| 154 | // Check for explicit ssh:// protocol |
| 155 | if strings.HasPrefix(url, "ssh://") { |
| 156 | return true |
| 157 | } |
| 158 | // Check for git@host:path format (SCP-like syntax) |
| 159 | // This format uses colon after host, not port number |
| 160 | if strings.HasPrefix(url, "git@") && strings.Contains(url, ":") { |
| 161 | // Make sure it's not an HTTPS URL with port (e.g., https://git@host:443/path) |
| 162 | if !strings.HasPrefix(url, "http://") && !strings.HasPrefix(url, "https://") { |
| 163 | return true |
| 164 | } |
| 165 | } |
| 166 | return false |
| 167 | } |
| 168 | |
| 169 | func isBranchName(ref string) bool { |
| 170 | // Full commit hashes are 40 hex characters |
no outgoing calls