diff options
Diffstat (limited to 'clone.go')
| -rw-r--r-- | clone.go | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -60,18 +60,17 @@ func clonePathHack(dirname string, basedir string, gopath string) (string, error // attempt to git clone if the go path doesn't exist // does a git clone, if it works, returns true -// workdir = /home/jcarr/go/src/ // gopath = go.wit.com/apps/helloworld func (f *Forge) Clone(gopath string) (*gitpb.Repo, error) { var err error - pb, err := f.Repos.NewGoPath(f.goSrc, gopath, "") - if err == nil { - return f.finishClone(gopath, pb.URL) + fullpath := filepath.Join(f.goSrc, gopath) + + if pb := f.Repos.FindByFullPath(fullpath); pb != nil { + // repo already exists + return pb, nil } - workdir := f.goSrc - fullpath := filepath.Join(workdir, gopath) - dirname := filepath.Base(fullpath) + dirname := filepath.Base(fullpath) basedir := strings.TrimSuffix(fullpath, dirname) url := "https://" + gopath @@ -123,7 +122,7 @@ func (f *Forge) finishClone(gopath string, giturl string) (*gitpb.Repo, error) { var err error newr := f.Repos.FindByGoPath(gopath) if newr == nil { - newr, err = f.Repos.NewGoPath(f.goSrc, gopath, giturl) + newr, err = f.NewGoRepo(gopath, giturl) } if newr == nil { log.Warn("forge.Clone() new repo can not be found or created for gopath", gopath) |
