直接调用git命令进行git clone
(rootDir string, actualGitRepoUrl string)
| 656 | |
| 657 | // 直接调用git命令进行git clone |
| 658 | func cloneRepo4LocalWithCommand(rootDir string, actualGitRepoUrl string) (string, error) { |
| 659 | // git repo check |
| 660 | repoUrl := common.GIT.GetRepositoryUrl(actualGitRepoUrl) |
| 661 | if repoUrl != "" { |
| 662 | checkCommand := common.GIT.GetCommand4RepositoryUrl(repoUrl) |
| 663 | result, err := common.EXEC.CombinedOutput(checkCommand, "") |
| 664 | if err != nil { |
| 665 | return "", err |
| 666 | } |
| 667 | httpCode, _ := strconv.Atoi(result) |
| 668 | customErr := common.GIT.CheckError4RepositoryUrl(repoUrl, httpCode) |
| 669 | if customErr != nil { |
| 670 | if customErr.GitRepoAccessStatus == common.GitRepoStatusEnum_NotExists { |
| 671 | return "", customErr |
| 672 | } else { |
| 673 | common.SmartIDELog.Warning(customErr.Error()) |
| 674 | } |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | // git clone for local |
| 679 | repoName := common.GetRepoName(actualGitRepoUrl) |
| 680 | repoPath := common.PathJoin(rootDir, repoName) |
| 681 | command := "git clone " + actualGitRepoUrl |
| 682 | err := common.EXEC.Realtime(command, "") |
| 683 | |
| 684 | return repoPath, err |
| 685 | } |
| 686 | |
| 687 | // 在某些情况下,参数填了也没有意义,比如指定了workspaceid,就不需要再填host |
| 688 | func checkFlagUnnecessary(fflags *pflag.FlagSet, flagName string, preFlagName string) { |
no test coverage detected