6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-10 19:34:17 +00:00

Finish refactoring by replacing old pkg with new one

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-28 16:34:44 +02:00
parent ca9be3d98f
commit 1bc3928cf5
14 changed files with 523 additions and 1432 deletions

View File

@@ -14,7 +14,7 @@ import (
var scpSyntax = regexp.MustCompile(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`)
func ParseURL(rawURL string) (url *urlpkg.URL, err error) {
// If rawURL matches the SCP-like syntax, convert it into a standard ssh URL.
// If rawURL matches the SCP-like syntax, convert it into a standard ssh Path.
// eg, git@github.com:user/repo => ssh://git@github.com/user/repo
if m := scpSyntax.FindStringSubmatch(rawURL); m != nil {
url = &urlpkg.URL{
@@ -26,12 +26,12 @@ func ParseURL(rawURL string) (url *urlpkg.URL, err error) {
} else {
url, err = urlpkg.Parse(rawURL)
if err != nil {
return nil, errors.Wrap(err, "Failed parsing URL")
return nil, errors.Wrap(err, "Failed parsing Path")
}
}
if url.Host == "" && url.Path == "" {
return nil, errors.New("Parsed URL is empty")
return nil, errors.New("Parsed Path is empty")
}
if url.Scheme == "git+ssh" {