Skip to content

Commit

Permalink
feat: supprot ssh gitUrl && more error log detail (cloudwego#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoranz758 authored Jan 2, 2024
1 parent 83bc93a commit f95d0a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/common/utils/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package utils

import (
"net/url"
"os"
"os/exec"
"strings"

Expand All @@ -31,10 +32,16 @@ func GitClone(gitURL, path string) error {
}
c := exec.Command("git", "clone", gitURL)
c.Dir = path
c.Stderr = os.Stderr
return c.Run()
}

func GitPath(gitURL string) (string, error) {
if len(gitURL) > 3 && gitURL[0:3] == "git" {
p := strings.Split(gitURL, consts.Slash)
path := p[len(p)-1]
return path[:len(path)-4], nil
}
u, err := url.Parse(gitURL)
if err != nil {
return "", err
Expand Down

0 comments on commit f95d0a4

Please sign in to comment.