joinHostPath assembles the canonical "host[/path]" form, trimming a leading "/" and a trailing ".git"/"/" from the path while preserving its case.
(host, path string)
| 454 | // joinHostPath assembles the canonical "host[/path]" form, trimming a leading |
| 455 | // "/" and a trailing ".git"/"/" from the path while preserving its case. |
| 456 | func joinHostPath(host, path string) string { |
| 457 | path = strings.TrimPrefix(path, "/") |
| 458 | path = strings.TrimSuffix(path, "/") |
| 459 | path = strings.TrimSuffix(path, ".git") |
| 460 | path = strings.TrimSuffix(path, "/") |
| 461 | if path == "" { |
| 462 | return host |
| 463 | } |
| 464 | return host + "/" + path |
| 465 | } |
| 466 | |
| 467 | // isLocalRemote reports whether a remote URL points at the local filesystem |
| 468 | // rather than a network host: a file:// URL, a POSIX absolute/relative/home |