fixes for Append()
This commit is contained in:
parent
a1bab32121
commit
4fcc1e0349
21
goSrcScan.go
21
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
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
3
init.go
3
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue