From 4fcc1e0349c8a0f13023639e17561bbcb050bffb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 31 Aug 2025 12:24:56 -0500 Subject: [PATCH] fixes for Append() --- goSrcScan.go | 21 +++++++++++++++++++++ humanShowRepo.go | 9 +-------- init.go | 3 +-- patchset.Make.go | 3 +-- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/goSrcScan.go b/goSrcScan.go index 5555ac5..2eac3e6 100644 --- a/goSrcScan.go +++ b/goSrcScan.go @@ -178,3 +178,24 @@ func (f *Forge) checkpath(gopath string, url string) (*gitpb.Repo, error) { } return repo, err } + +// deletes the repo from the protobuf (pray your mutex locks are working) +// re-scans the repo +// returns the new repo +func (f *Forge) ReAdd(repo *gitpb.Repo) (*gitpb.Repo, error) { + if repo == nil { + return nil, log.Errorf("can't delete repo == nil") + } + fullpath := repo.GetFullPath() + ns := repo.GetNamespace() + if !f.Repos.Delete(repo) { + return nil, log.Errorf("delete of repo failed") + } + + repo, err := f.AddNamespaceDir(ns, fullpath) + if err != nil { + log.Info("ReAdd() error", fullpath, err) + return nil, err + } + return repo, err +} diff --git a/humanShowRepo.go b/humanShowRepo.go index 8f2348a..066ff6f 100644 --- a/humanShowRepo.go +++ b/humanShowRepo.go @@ -61,14 +61,7 @@ func (f *Forge) HumanPrintRepo(check *gitpb.Repo) { log.Info("git current name ==", check.GetCurrentBranchName()) // testNext(check) - - found := new(gitpb.Repos) - if !found.AppendByGoPath(check) { - log.Info("forgepb check. repo already existed", check.FullPath, check.GetGoPath()) - } else { - log.Info("forgepb check. repo was new", check.FullPath, check.GetGoPath()) - } - f.PrintHumanTable(found) + // f.PrintHumanTable(check) printTime("Last Pull", check.Times.LastPull.AsTime()) printTime("Last Dirty", check.Times.LastDirty.AsTime()) diff --git a/init.go b/init.go index a736bcf..9f5dea6 100644 --- a/init.go +++ b/init.go @@ -9,7 +9,6 @@ import ( "time" "go.wit.com/lib/gui/shell" - "go.wit.com/lib/hostname" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -171,7 +170,7 @@ func (f *Forge) InitMachine() { usr, _ := user.Current() f.Config.Username = usr.Username } - f.hostname, _ = hostname.Get() + f.hostname, _ = os.Hostname() // log.Info(hostname, err) } diff --git a/patchset.Make.go b/patchset.Make.go index a5e8db7..84d30ea 100644 --- a/patchset.Make.go +++ b/patchset.Make.go @@ -9,7 +9,6 @@ import ( "time" "github.com/google/uuid" - "go.wit.com/lib/hostname" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" timestamppb "google.golang.org/protobuf/types/known/timestamppb" @@ -20,7 +19,7 @@ func newPatchset(name string) *Patchset { pset.Name = name pset.Ctime = timestamppb.New(time.Now()) pset.Uuid = uuid.New().String() - pset.Hostname, _ = hostname.Get() + pset.Hostname, _ = os.Hostname() return pset }