diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2021-09-08 17:19:00 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2021-09-08 17:19:00 +0200 |
| commit | d60ffba47afa7fc9c2816dd5e4b19fdbd9f06af5 (patch) | |
| tree | 6b570349629a7a2da1230565f90326844c545eb7 /internal/rtree | |
| parent | 308bbb597c7c572e86c623507f4af79c128aac43 (diff) | |
| parent | 8cea64eb2a4e51275bda51533536f9d7ad358208 (diff) | |
| download | gofu-d60ffba47afa7fc9c2816dd5e4b19fdbd9f06af5.tar.gz | |
Merge branch 'strip-git'
Diffstat (limited to 'internal/rtree')
| -rw-r--r-- | internal/rtree/remote.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/rtree/remote.go b/internal/rtree/remote.go index 484dd92..8435979 100644 --- a/internal/rtree/remote.go +++ b/internal/rtree/remote.go @@ -84,16 +84,18 @@ var scpSyntaxRx = regexp.MustCompile(`^(?:[^/@:]+@)?([^/:]+\.[^/:]+):(.+)$`) //CheckoutPath derives the checkout path for a remote URL. // // RemoteURL("https://example.org/foo/bar") -> "example.org/foo/bar" -// RemoteURL("git@example.org:foo/bar") -> "example.org/foo/bar" +// RemoteURL("git@example.org:foo/bar.git") -> "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 } - parsed, err := url.Parse(u.CanonicalURL()) + parsed, err := url.Parse(stripped) if err != nil { return "", err } |
