diff options
| author | Sandro Jäckel <sandro.jaeckel@sap.com> | 2021-09-08 16:13:52 +0200 |
|---|---|---|
| committer | Sandro Jäckel <sandro.jaeckel@sap.com> | 2021-09-08 16:13:52 +0200 |
| commit | 4e0b90e3fb9c2c1276a695692179f59dda481e81 (patch) | |
| tree | 10bdffe20881101d5d9b20cd74cae94a422b0e9f | |
| parent | 308bbb597c7c572e86c623507f4af79c128aac43 (diff) | |
| download | gofu-4e0b90e3fb9c2c1276a695692179f59dda481e81.tar.gz | |
rtree: strip final .git from clone URLs
otherwise paths contain a final .git when using the clone URLs copied from the GitHub Web UI
| -rw-r--r-- | internal/rtree/remote.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/rtree/remote.go b/internal/rtree/remote.go index 484dd92..6e073a5 100644 --- a/internal/rtree/remote.go +++ b/internal/rtree/remote.go @@ -87,7 +87,8 @@ var scpSyntaxRx = regexp.MustCompile(`^(?:[^/@:]+@)?([^/:]+\.[^/:]+):(.+)$`) // RemoteURL("git@example.org:foo/bar") -> "example.org/foo/bar" // func (u RemoteURL) CheckoutPath() (string, error) { - match := scpSyntaxRx.FindStringSubmatch(u.CanonicalURL()) + stripped := strings.TrimSuffix(u.CanonicalURL(), ".git") + match := scpSyntaxRx.FindStringSubmatch(stripped) if match != nil { //match[1] is the hostname, match[2] is the path to the repo return filepath.Join(match[1], match[2]), nil |
