joinHostPath assembles the canonical "host[/path]" form, trimming a leading "/" and a trailing ".git"/"/" from the path while preserving its case.
(host, path string)
| 477 | // joinHostPath assembles the canonical "host[/path]" form, trimming a leading |
| 478 | // "/" and a trailing ".git"/"/" from the path while preserving its case. |
| 479 | func joinHostPath(host, path string) string { |
| 480 | path = strings.TrimPrefix(path, "/") |
| 481 | path = strings.TrimSuffix(path, "/") |
| 482 | path = strings.TrimSuffix(path, ".git") |
| 483 | path = strings.TrimSuffix(path, "/") |
| 484 | if path == "" { |
| 485 | return host |
| 486 | } |
| 487 | return host + "/" + path |
| 488 | } |
| 489 | |
| 490 | // isLocalRemote reports whether a remote URL points at the local filesystem |
| 491 | // rather than a network host: a file:// URL, a POSIX absolute/relative/home |