joinHostPath assembles the canonical "host[/path]" form, trimming a leading "/" and a trailing ".git"/"/" from the path while preserving its case.
(host, path string)
| 538 | // joinHostPath assembles the canonical "host[/path]" form, trimming a leading |
| 539 | // "/" and a trailing ".git"/"/" from the path while preserving its case. |
| 540 | func joinHostPath(host, path string) string { |
| 541 | path = strings.TrimPrefix(path, "/") |
| 542 | path = strings.TrimSuffix(path, "/") |
| 543 | path = strings.TrimSuffix(path, ".git") |
| 544 | path = strings.TrimSuffix(path, "/") |
| 545 | if path == "" { |
| 546 | return host |
| 547 | } |
| 548 | return host + "/" + path |
| 549 | } |
| 550 | |
| 551 | // isLocalRemote reports whether a remote URL points at the local filesystem |
| 552 | // rather than a network host: a file:// URL, a POSIX absolute/relative/home |