diff options
| author | Jeff Carr <[email protected]> | 2024-12-17 06:37:00 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-17 06:37:00 -0600 |
| commit | ee7e8d5b2ba38bcc53b210c9a04ccff0de4a4f19 (patch) | |
| tree | f7de75c50610d1fd7891834c9af7f0e555c145ce /repoNew.go | |
| parent | b2e51ccb9efc326fda8615b1d2ad9f2ea3f16652 (diff) | |
lots of changes in gitpb
Diffstat (limited to 'repoNew.go')
| -rw-r--r-- | repoNew.go | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -14,11 +14,15 @@ func (f *Forge) NewGoRepo(gopath string, url string) (*gitpb.Repo, error) { fullpath := filepath.Join(f.GetGoSrc(), gopath) repo, err := f.Repos.NewGoRepo(fullpath, gopath) if err != nil { + log.Info("WARNING. NEW FAILED", fullpath) return nil, err } repo.URL = url f.VerifyBranchNames(repo) - repo.Reload() + if f.Config.IsReadOnly(repo.GetGoPath()) { + repo.ReadOnly = true + } + repo.InitVersions() return repo, nil } @@ -43,15 +47,20 @@ func (f *Forge) ValidGoVersion(ver string) (bool, error) { func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) { // log.Info("init worked for", newr.GoPath) + var mname string if newr.GetMasterBranchName() == "" { // try to guess what the 'master' branch is if newr.IsBranch("guimaster") { + mname = "guimaster" newr.SetMasterBranchName("guimaster") } else if newr.IsBranch("master") { + mname = "master" newr.SetMasterBranchName("master") } else if newr.IsBranch("main") { + mname = "main" newr.SetMasterBranchName("main") } else { + mname = "master" // todo, figure out the name from git newr.SetMasterBranchName("master") if newr.CheckoutMaster() { @@ -61,10 +70,7 @@ func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) { } } } - - if f.Config.IsReadOnly(newr.GoPath) { - return - } + log.Info("forge.NewRepo() SET MASTER TO", mname) if newr.GetDevelBranchName() == "" { if newr.IsBranch("guidevel") { @@ -131,3 +137,13 @@ func (f *Forge) AddFullPath(fulldir string) *gitpb.Repo { log.Info("don't know how to add full paths yet", fulldir) return nil } + +func (f *Forge) FindByGoPath(gopath string) *gitpb.Repo { + fullpath := filepath.Join(f.GetGoSrc(), gopath) + return f.Repos.FindByFullPath(fullpath) +} + +func (f *Forge) DeleteByGoPath(gopath string) bool { + fullpath := filepath.Join(f.GetGoSrc(), gopath) + return f.Repos.DeleteByFullPath(fullpath) +} |
