From 4fcc1e0349c8a0f13023639e17561bbcb050bffb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 31 Aug 2025 12:24:56 -0500 Subject: fixes for Append() --- goSrcScan.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'goSrcScan.go') 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 +} -- cgit v1.2.3