MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / GetRepositoryUrl

Method GetRepositoryUrl

cli/pkg/common/git.go:52–72  ·  view source on GitHub ↗

获取 repo url

(actualGitRepoUrl string)

Source from the content-addressed store, hash-verified

50
51// 获取 repo url
52func (g gitOperation) GetRepositoryUrl(actualGitRepoUrl string) string {
53 if runtime.GOOS == "windows" {
54 return ""
55 }
56 uri, err := url.Parse(actualGitRepoUrl)
57 if err != nil {
58 SmartIDELog.Warning(err.Error())
59 return ""
60 }
61 if uri == nil {
62 return ""
63 }
64 if uri.Scheme == "https" || uri.Scheme == "http" {
65 if actualGitRepoUrl[len(actualGitRepoUrl)-4:] == ".git" {
66 return actualGitRepoUrl[:len(actualGitRepoUrl)-4]
67 } else {
68 return actualGitRepoUrl
69 }
70 }
71 return ""
72}
73
74// 获取检查 git repo 是否存在的command
75func (g gitOperation) GetCommand4RepositoryUrl(actualGitRepoUrl string) string {

Callers 4

GitCloneMethod · 0.80
GitCloneMethod · 0.80

Calls 2

WarningMethod · 0.80
ErrorMethod · 0.45

Tested by 1