load repos output is cleaner

This commit is contained in:
Jeff Carr 2025-01-19 03:18:47 -06:00
parent f4ac491490
commit 244bf612f9
2 changed files with 12 additions and 9 deletions

View File

@ -160,10 +160,10 @@ func (f *Forge) rillScanDirs(gopaths []string) (int, error) {
func (f *Forge) checkpath(gopath string, url string) (*gitpb.Repo, error) { func (f *Forge) checkpath(gopath string, url string) (*gitpb.Repo, error) {
fullpath := filepath.Join(f.GetGoSrc(), gopath) fullpath := filepath.Join(f.GetGoSrc(), gopath)
log.Info("checkpath()", gopath, fullpath) log.Info("forge creating protobuf for", fullpath)
repo, err := f.NewGoRepo(gopath, "") repo, err := f.NewGoRepo(gopath, "")
if err != nil { if err != nil {
log.Info("checkpath()", gopath, err) log.Info("\tprotobuf error", gopath, err)
} }
return repo, err return repo, err
} }

View File

@ -5,7 +5,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"slices"
"strings" "strings"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
@ -18,15 +17,12 @@ func (f *Forge) NewGoRepo(gopath string, url string) (*gitpb.Repo, error) {
if test != nil { if test != nil {
return test, nil return test, nil
} }
log.Info("LEN START", f.Repos.Len())
repo, err := f.Repos.NewGoRepo(fullpath, gopath) repo, err := f.Repos.NewGoRepo(fullpath, gopath)
if err != nil { if err != nil {
log.Info("WARNING. NEW FAILED", fullpath) log.Info("WARNING. NEW FAILED", fullpath)
return nil, err return nil, err
} }
log.Info("LEN END", f.Repos.Len()) // slices.Reverse(f.Repos.Repos)
slices.Reverse(f.Repos.Repos)
log.Info("LEN END", f.Repos.Len())
repo.URL = url repo.URL = url
f.VerifyBranchNames(repo) f.VerifyBranchNames(repo)
@ -86,7 +82,7 @@ func (f *Forge) findMasterBranch(repo *gitpb.Repo) {
if strings.HasPrefix(s, "ref: ") { if strings.HasPrefix(s, "ref: ") {
fields := strings.Fields(s) fields := strings.Fields(s)
_, bname := filepath.Split(fields[1]) _, bname := filepath.Split(fields[1])
log.Info("Using master branch name from .git/ HEAD:", bname) // log.Info("Using master branch name from .git/ HEAD:", bname)
repo.SetMasterBranchName(bname) repo.SetMasterBranchName(bname)
return return
} }
@ -105,11 +101,13 @@ func (f *Forge) findMasterBranch(repo *gitpb.Repo) {
// TODO: figure out the name from git // TODO: figure out the name from git
repo.SetMasterBranchName("master") repo.SetMasterBranchName("master")
/* no longer checkout on Init()
if repo.CheckoutMaster() { if repo.CheckoutMaster() {
} else { } else {
cmd := []string{"git", "branch", "master"} cmd := []string{"git", "branch", "master"}
repo.Run(cmd) repo.Run(cmd)
} }
*/
} }
// figure out what the name of the git devel branch is // figure out what the name of the git devel branch is
@ -118,11 +116,13 @@ func (f *Forge) findDevelBranch(repo *gitpb.Repo) {
// check the forge config first // check the forge config first
if bname := f.Config.FindDevelBranch(repo.GetGoPath()); bname != "" { if bname := f.Config.FindDevelBranch(repo.GetGoPath()); bname != "" {
repo.SetDevelBranchName(bname) repo.SetDevelBranchName(bname)
/* no longer checkout on Init()
if repo.CheckoutDevel() { if repo.CheckoutDevel() {
} else { } else {
cmd := []string{"git", "branch", bname} cmd := []string{"git", "branch", bname}
repo.Run(cmd) repo.Run(cmd)
} }
*/
return return
} }
@ -131,13 +131,14 @@ func (f *Forge) findDevelBranch(repo *gitpb.Repo) {
return return
} }
// TODO: figure out the name from git
repo.SetDevelBranchName("devel") repo.SetDevelBranchName("devel")
/* no longer checkout on Init()
if repo.CheckoutDevel() { if repo.CheckoutDevel() {
} else { } else {
cmd := []string{"git", "branch", "devel"} cmd := []string{"git", "branch", "devel"}
repo.Run(cmd) repo.Run(cmd)
} }
*/
} }
// this is still in flux // this is still in flux
@ -159,11 +160,13 @@ func (f *Forge) VerifyBranchNames(repo *gitpb.Repo) {
} else { } else {
// forcing for now. todo: warn users // forcing for now. todo: warn users
repo.SetUserBranchName(uname) repo.SetUserBranchName(uname)
/* no longer checkout on Init()
if repo.CheckoutUser() { if repo.CheckoutUser() {
} else { } else {
cmd := []string{"git", "branch", uname} cmd := []string{"git", "branch", uname}
repo.Run(cmd) repo.Run(cmd)
} }
*/
} }
} }
} }