diff options
Diffstat (limited to 'repoClone.go')
| -rw-r--r-- | repoClone.go | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/repoClone.go b/repoClone.go index 1c1ffa0..2afc6fa 100644 --- a/repoClone.go +++ b/repoClone.go @@ -13,71 +13,6 @@ import ( "go.wit.com/log" ) -/* -// guess the paths. returns - -// realpath : the actual path on the filesystem -// goSrcPath : this could be ~/go/src, or where the go.work file is - -// goPath : go.wit.com/lib/gui/repostatus (for example) -// true/false if the repo is a golang repo -func (f *Forge) guessPaths(path string) (string, string, string, bool, error) { - var realpath, goSrcDir string - var isGoLang bool = false - - homeDir, err := os.UserHomeDir() - if err != nil { - log.Log(FORGEPBWARN, "Error getting home directory:", err) - return path, realpath, goSrcDir, false, err - } - goSrcDir = filepath.Join(homeDir, "go/src") - - // allow arbitrary paths, otherwise, assume the repo is in ~/go/src - // unless REPO_WORK_PATH was set. to over-ride ~/go/src - // todo, look for go.work - if os.Getenv("REPO_WORK_PATH") == "" { - os.Setenv("REPO_WORK_PATH", goSrcDir) - } else { - goSrcDir = os.Getenv("REPO_WORK_PATH") - } - - // todo: this is dumb - if strings.HasPrefix(path, "/") { - realpath = path - } else if strings.HasPrefix(path, "~") { - tmp := strings.TrimPrefix(path, "~") - realpath = filepath.Join(homeDir, tmp) - } else { - realpath = filepath.Join(goSrcDir, path) - isGoLang = true - } - - if os.Getenv("REPO_AUTO_CLONE") == "true" { - err := f.Clone(goSrcDir, path) - if err != nil { - // directory doesn't exist. exit with nil and error nil - return path, realpath, goSrcDir, false, errors.New("git clone") - } - } - - if !IsDirectory(realpath) { - log.Log(FORGEPBWARN, "directory doesn't exist", realpath) - // directory doesn't exist. exit with nil and error nil - return path, realpath, goSrcDir, false, errors.New(realpath + " does not exist") - } - - filename := filepath.Join(realpath, ".git/config") - - _, err = os.Open(filename) - if err != nil { - // log.Log(WARN, "Error reading .git/config:", filename, err) - // log.Log(WARN, "TODO: find .git/config in parent directory") - return path, realpath, goSrcDir, false, err - } - return path, realpath, goSrcDir, isGoLang, nil -} -*/ - // TODO: make some config file for things like this // can be used to work around temporary problems func clonePathHack(dirname string, basedir string, gopath string) (string, error) { |
