fixes to clone

This commit is contained in:
Jeff Carr 2024-12-18 17:58:25 -06:00
parent b80b7baa2d
commit d473f80919
1 changed files with 2 additions and 9 deletions

View File

@ -6,7 +6,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log" "go.wit.com/log"
) )
@ -20,14 +19,14 @@ func clone(gopath string) (*gitpb.Repo, error) {
} }
os.Setenv("REPO_AUTO_CLONE", "true") os.Setenv("REPO_AUTO_CLONE", "true")
// pb, _ := forge.NewGoPath(gopath) // pb, _ := forge.NewGoPath(gopath)
check := forge.FindByGoPath(gopath) check := forge.FindAnyPath(filepath.Join(forge.GetGoSrc(), gopath))
if check != nil { if check != nil {
if check.IsValidDir() { if check.IsValidDir() {
// repo already exists and is valid // repo already exists and is valid
return check, nil return check, nil
} }
} }
pb, err := forge.Clone(gopath) pb, err := forge.GoClone(gopath)
if err != nil { if err != nil {
log.Info("clone() could not download err:", err) log.Info("clone() could not download err:", err)
return nil, err return nil, err
@ -37,12 +36,6 @@ func clone(gopath string) (*gitpb.Repo, error) {
return nil, err return nil, err
} }
// double check it actually downloaded
fullgitdir := filepath.Join(forge.GetGoSrc(), gopath, ".git")
if !shell.IsDir(fullgitdir) {
log.Info("repo cloned failed", filepath.Join(forge.GetGoSrc(), gopath))
return nil, errors.New(fullgitdir + " was not created")
}
log.Info("go-clone clone() onward and upward") log.Info("go-clone clone() onward and upward")
return pb, nil return pb, nil
} }