MCPcopy Index your code
hub / github.com/nikivdev/go / normalizeRemoteURL

Function normalizeRemoteURL

cli/flow/main.go:5013–5033  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

5011}
5012
5013func 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
5035func extractRemoteHostPath(raw string) (string, string, bool) {
5036 trimmed := strings.TrimSpace(raw)

Callers 1

urlsEquivalentFunction · 0.85

Calls 1

extractRemoteHostPathFunction · 0.85

Tested by

no test coverage detected