6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-04 18:34:51 +00:00

Refactor Clone method to use go-git

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-27 12:54:49 +02:00
parent 616b476ce1
commit b94e655d4a
5 changed files with 99 additions and 19 deletions

View File

@@ -14,8 +14,8 @@ 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 SCP-like syntax, convert it into a URL.
// eg, "git@github.com:user/repo" becomes "ssh://git@github.com/user/repo".
// If rawURL matches the SCP-like syntax, convert it into a standard ssh URL.
// eg, git@github.com:user/repo => ssh://git@github.com/user/repo
if m := scpSyntax.FindStringSubmatch(rawURL); m != nil {
url = &urlpkg.URL{
Scheme: "ssh",