(raw string)
| 5011 | } |
| 5012 | |
| 5013 | func normalizeRemoteURL(raw string) string { |
| 5014 | trimmed := strings.TrimSpace(raw) |
| 5015 | if trimmed == "" { |
| 5016 | return "" |
| 5017 | } |
| 5018 | |
| 5019 | if host, path, ok := extractRemoteHostPath(trimmed); ok { |
| 5020 | if host != "" && path != "" { |
| 5021 | return host + "/" + path |
| 5022 | } |
| 5023 | if host != "" { |
| 5024 | return host |
| 5025 | } |
| 5026 | if path != "" { |
| 5027 | return path |
| 5028 | } |
| 5029 | } |
| 5030 | |
| 5031 | trimmed = strings.TrimSuffix(trimmed, ".git") |
| 5032 | return strings.TrimSuffix(trimmed, "/") |
| 5033 | } |
| 5034 | |
| 5035 | func extractRemoteHostPath(raw string) (string, string, bool) { |
| 5036 | trimmed := strings.TrimSpace(raw) |
no test coverage detected