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

Function cloneRepo4LocalWithCommand

cli/cmd/common/workspace.go:658–685  ·  view source on GitHub ↗

直接调用git命令进行git clone

(rootDir string, actualGitRepoUrl string)

Source from the content-addressed store, hash-verified

656
657// 直接调用git命令进行git clone
658func 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
688func checkFlagUnnecessary(fflags *pflag.FlagSet, flagName string, preFlagName string) {

Callers 1

GetWorkspaceFromCmdFunction · 0.85

Calls 7

GetRepositoryUrlMethod · 0.80
CombinedOutputMethod · 0.80
WarningMethod · 0.80
RealtimeMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected