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