获取 repo url
(actualGitRepoUrl string)
| 50 | |
| 51 | // 获取 repo url |
| 52 | func (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 |
| 75 | func (g gitOperation) GetCommand4RepositoryUrl(actualGitRepoUrl string) string { |