getRepoNameFromUrlPath returns the last segment of url path as repo name, without .git suffix.
(path string)
| 371 | // getRepoNameFromUrlPath |
| 372 | // returns the last segment of url path as repo name, without .git suffix. |
| 373 | func getRepoNameFromUrlPath(path string) string { |
| 374 | // Remove leading and trailing slashes |
| 375 | path = strings.Trim(path, "/") |
| 376 | // Remove .git suffix |
| 377 | path = strings.TrimSuffix(path, ".git") |
| 378 | // Get last segment |
| 379 | return path[strings.LastIndex(path, "/")+1:] |
| 380 | } |
no outgoing calls
no test coverage detected