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