summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-17 06:37:14 -0600
committerJeff Carr <[email protected]>2024-12-17 06:37:14 -0600
commit233f7bca767aab9df55adea409e9820050631586 (patch)
tree1ce61760e8b31077b9accc9b1da978d935a132d3
parent4bc95ad2684cb42159229b8198aa8a2377f80aa1 (diff)
lots of changes to isolate exec 'git'
-rw-r--r--age.go6
-rw-r--r--changed.go21
-rw-r--r--common.go (renamed from set.go)10
-rw-r--r--config.go47
-rw-r--r--currentVersions.go48
-rw-r--r--goDep.helpers.go2
-rw-r--r--goDep.parseGoSum.go2
-rw-r--r--goDep.redoGoMod.go2
-rw-r--r--isPrimitive.go6
-rw-r--r--makePatches.go2
-rw-r--r--reload.go27
-rw-r--r--reloadIsTracked.go10
-rw-r--r--reloadRepoType.go46
-rw-r--r--repo.new.go25
-rw-r--r--repo.proto43
-rw-r--r--rill.go4
-rw-r--r--shell.go2
17 files changed, 172 insertions, 131 deletions
diff --git a/age.go b/age.go
index d70c863..1249a6e 100644
--- a/age.go
+++ b/age.go
@@ -28,7 +28,7 @@ func (repo *Repo) GoSumAge() (time.Duration, error) {
return time.Since(mtime), nil
}
now := time.Now()
- return time.Since(now), errors.New(repo.GoPath + " go.mod missing")
+ return time.Since(now), errors.New(repo.GetGoPath() + " go.mod missing")
}
func (repo *Repo) GitChanged() bool {
@@ -39,7 +39,7 @@ func (repo *Repo) GitChanged() bool {
log.Info("gitpb:", fullfile, "changed")
return true
}
- newtime := repo.LastPull.AsTime()
+ newtime := repo.Times.LastPull.AsTime()
if lasttime == newtime {
return false
@@ -52,7 +52,7 @@ func (repo *Repo) GitPullAge() time.Duration {
lastpull, err := repo.LastGitPull()
if err == nil {
// if error, something is wrong, assume true
- ltime := repo.LastPull.AsTime()
+ ltime := repo.Times.LastPull.AsTime()
return time.Since(ltime)
}
diff --git a/changed.go b/changed.go
index d9d4bad..4d6fed4 100644
--- a/changed.go
+++ b/changed.go
@@ -29,8 +29,12 @@ func (repo *Repo) changedDir() bool {
// .git doesn't exist. something is wrong. rescan this repo
return true
}
- pbtime := repo.Times.MtimeDir
mtime := timestamppb.New(*fileTime)
+ pbtime := repo.Times.MtimeDir
+ if pbtime == nil { // this can happen?
+ repo.Times.MtimeDir = mtime
+ return true
+ }
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
return false
}
@@ -47,8 +51,13 @@ func (repo *Repo) changedHead() bool {
// .git/HEAD doesn't exist. something is wrong. rescan this repo
return true
}
- pbtime := repo.Times.MtimeHead
mtime := timestamppb.New(*fileTime)
+ pbtime := repo.Times.MtimeHead
+ if pbtime == nil { // this can happen?
+ repo.Times.MtimeHead = mtime
+ return true
+ }
+
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
return false
}
@@ -65,8 +74,12 @@ func (repo *Repo) changedIndex() bool {
// .git/index doesn't exist. something is wrong. rescan this repo
return true
}
- pbtime := repo.Times.MtimeIndex
mtime := timestamppb.New(*fileTime)
+ pbtime := repo.Times.MtimeIndex
+ if pbtime == nil { // this can happen?
+ repo.Times.MtimeIndex = mtime
+ return true
+ }
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
return false
}
@@ -90,7 +103,7 @@ func (repo *Repo) RepoChanged() bool {
changed = true
}
if repo.changedDir() {
- changed = true
+ // changed = true
}
return changed
diff --git a/set.go b/common.go
index 8821e0d..cd88d45 100644
--- a/set.go
+++ b/common.go
@@ -1,5 +1,7 @@
package gitpb
+import "go.wit.com/log"
+
func (repo *Repo) SetReadOnly(b bool) {
repo.ReadOnly = b
}
@@ -9,5 +11,13 @@ func (repo *Repo) SetTargetVersion(target string) {
}
func (repo *Repo) SetMasterBranchName(s string) {
+ log.Info("gitpb.SetMaster() SET MASTER TO", s)
repo.MasterBranchName = s
}
+
+func (repo *Repo) GetGoPath() string {
+ if repo.GoInfo == nil {
+ return ""
+ }
+ return repo.GoInfo.GoPath
+}
diff --git a/config.go b/config.go
index 2fc02d0..9b38238 100644
--- a/config.go
+++ b/config.go
@@ -33,7 +33,9 @@ func (all *Repos) ConfigSave() error {
return nil
}
-// load the ~/.config/forge/ files
+// load the repos.pb file. I shouldn't really matter if this
+// fails. the file should be autogenerated. This is used
+// locally just for speed
func (all *Repos) ConfigLoad() error {
if os.Getenv("FORGE_GOSRC") == "" {
homeDir, _ := os.UserHomeDir()
@@ -46,36 +48,25 @@ func (all *Repos) ConfigLoad() error {
cfgname := filepath.Join(os.Getenv("FORGE_GOSRC"), "repos.pb")
if data, err = loadFile(cfgname); err != nil {
// something went wrong loading the file
+ // all.sampleConfig() // causes nil panic
return err
}
- if data != nil {
- // this means the forge.pb file exists and was read
- if len(data) == 0 {
- // todo: error out if the file is empty?
- // try forge.text & forge.json?
- log.Warn("gitpb.ConfigLoad() repos.pb is empty")
- return errors.New("gitpb.ConfigLoad() repos.pb is empty")
- }
- if all.Repos == nil {
- // log.Warn("gitpb.ConfigLoad() all.Repos == nil")
- } else {
- log.Warn("gitpb.ConfigLoad() error. should be zero. all.Repos.Len() =", all.Len())
- }
- if err = all.Unmarshal(data); err != nil {
- log.Warn("gitpb.ConfigLoad() failed", err)
- if all.Repos == nil {
- log.Warn("gitpb.ConfigLoad() all.Repos == nil")
- } else {
- log.Warn("gitpb.ConfigLoad() all.Repos.Len()", all.Len())
- log.Warn("gitpb.ConfigLoad() trying to resave the file")
- all.ConfigSave()
- }
- return err
- }
- log.Info("gitpb.Init() ", len(all.Repos), "repos in", cfgname)
- return nil
+ // this means the forge.pb file exists and was read
+ if len(data) == 0 {
+ all.sampleConfig() // causes nil panic
+ return errors.New("gitpb.ConfigLoad() repos.pb is empty")
+ }
+ return all.Unmarshal(data)
+}
+
+func (all *Repos) sampleConfig() {
+ newr := new(Repo)
+ newr.FullPath = "/opt/forge/dummyentry"
+ if all.Append(newr) {
+ log.Info("added", newr.GetGoPath(), "ok")
+ } else {
+ log.Info("added", newr.GetGoPath(), "failed")
}
- return nil
}
func loadFile(fullname string) ([]byte, error) {
diff --git a/currentVersions.go b/currentVersions.go
index 8b9d16f..d93df8d 100644
--- a/currentVersions.go
+++ b/currentVersions.go
@@ -14,44 +14,50 @@ import (
"go.wit.com/log"
)
-func (repo *Repo) GetMasterVersion() string {
+func (repo *Repo) InitVersions() {
+ repo.setMasterVersion()
+ repo.setDevelVersion()
+ repo.setUserVersion()
+}
+
+func (repo *Repo) setMasterVersion() {
bname := repo.GetMasterBranchName()
v, err := repo.gitVersionByName(bname)
/*
count := repo.LenGitTags()
- log.Info(repo.GoPath, "tag count", count)
+ log.Info(repo.GetGoPath(), "tag count", count)
repo.UpdateGitTags()
count = repo.LenGitTags()
- log.Info(repo.GoPath, "tag count", count)
+ log.Info(repo.GetGoPath(), "tag count", count)
*/
if err == nil {
- return v
+ repo.MasterVersion = v
} else {
log.Log(GITPBWARN, "gitpb.GitMasterVersion() error:", err)
- return ""
+ repo.MasterVersion = "giterr"
}
}
-func (repo *Repo) GetDevelVersion() string {
+func (repo *Repo) setDevelVersion() {
bname := repo.GetDevelBranchName()
v, err := repo.gitVersionByName(bname)
if err == nil {
- return v
+ repo.DevelVersion = v
} else {
log.Log(GITPBWARN, "gitpb.GitDevelVersion() error:", err)
- return ""
+ repo.DevelVersion = "deverr"
}
}
-func (repo *Repo) GetUserVersion() string {
+func (repo *Repo) setUserVersion() {
bname := repo.GetUserBranchName()
v, err := repo.gitVersionByName(bname)
if err == nil {
- return v
+ repo.UserVersion = v
} else {
log.Log(GITPBWARN, "gitpb.GitUserVersion() error:", err)
- return ""
+ repo.UserVersion = "uerr"
}
}
@@ -61,7 +67,7 @@ func (repo *Repo) GetCurrentBranchName() string {
r := repo.RunQuiet([]string{"git", "branch", "--show-current"})
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Log(GITPBWARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GoPath)
+ log.Log(GITPBWARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GetGoPath())
log.Log(GITPBWARN, "GetCurrentBranchName() output might have worked anyway:", output)
}
return strings.TrimSpace(output)
@@ -92,7 +98,7 @@ func (repo *Repo) gitDescribeByHash(hash string) (string, error) {
r := repo.RunQuiet([]string{"git", "describe", "--tags", "--always", hash})
out := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Warn("not in a git repo or bad hash?", r.Error, repo.GoPath)
+ log.Warn("not in a git repo or bad hash?", r.Error, repo.GetGoPath())
return out, r.Error
}
return out, r.Error
@@ -137,7 +143,7 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
log.Log(GITPBWARN, "gitDescribeByName() output might have worked anyway:", output)
- log.Log(GITPBWARN, "gitDescribeByName() not in a git repo?", r.Error, repo.GoPath)
+ log.Log(GITPBWARN, "gitDescribeByName() not in a git repo?", r.Error, repo.GetGoPath())
return "", r.Error
}
return strings.TrimSpace(output), nil
@@ -154,7 +160,7 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
log.Log(GITPBWARN, "cmd =", cmd)
log.Log(GITPBWARN, "err =", result.Error)
log.Log(GITPBWARN, "output (might have worked with error?) =", output)
- log.Log(GITPBWARN, "not in a git repo or bad tag?", repo.GoPath)
+ log.Log(GITPBWARN, "not in a git repo or bad tag?", repo.GetGoPath())
return "", result.Error
}
@@ -179,13 +185,13 @@ func (repo *Repo) IsBranch(findname string) bool {
continue
}
path, filename := filepath.Split(tagname)
- log.Log(GITPB, "gitpb.IsBranch() tag:", path, filename, "from", repo.GoPath)
+ log.Log(GITPB, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
if filename == findname {
- log.Log(GITPB, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GoPath)
+ log.Log(GITPB, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
return true
}
}
- log.Log(GITPB, "did not find tag:", findname, "in", repo.GoPath)
+ log.Log(GITPB, "did not find tag:", findname, "in", repo.GetGoPath())
return false
}
@@ -201,13 +207,13 @@ func (repo *Repo) IsLocalBranch(findname string) bool {
continue
}
path, filename := filepath.Split(tagname)
- log.Log(GITPB, "gitpb.IsBranch() tag:", path, filename, "from", repo.GoPath)
+ log.Log(GITPB, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
if filename == findname {
- log.Log(GITPB, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GoPath)
+ log.Log(GITPB, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
return true
}
}
- log.Log(GITPB, "did not find tag:", findname, "in", repo.GoPath)
+ log.Log(GITPB, "did not find tag:", findname, "in", repo.GetGoPath())
return false
}
diff --git a/goDep.helpers.go b/goDep.helpers.go
index ced3fea..bb30151 100644
--- a/goDep.helpers.go
+++ b/goDep.helpers.go
@@ -18,7 +18,7 @@ func (repo *Repo) AppendGoDep(newP *GoDep) bool {
// returns time.Duration since last scan of go.sum & go.mod
func (repo *Repo) AgeGoDep() time.Duration {
- t := time.Since(repo.LastGoDep.AsTime())
+ t := time.Since(repo.Times.LastGoDep.AsTime())
return t
}
diff --git a/goDep.parseGoSum.go b/goDep.parseGoSum.go
index e275f0e..e7bd1a9 100644
--- a/goDep.parseGoSum.go
+++ b/goDep.parseGoSum.go
@@ -64,6 +64,7 @@ func (repo *Repo) ParseGoSum() (bool, error) {
return true, nil
}
+/*
// reads and parses the go.sum file
// is identical to the one above, change that
func (repo *Repo) UpdatePublished() (bool, error) {
@@ -108,3 +109,4 @@ func (repo *Repo) UpdatePublished() (bool, error) {
}
return true, nil
}
+*/
diff --git a/goDep.redoGoMod.go b/goDep.redoGoMod.go
index 633f07f..ee9e669 100644
--- a/goDep.redoGoMod.go
+++ b/goDep.redoGoMod.go
@@ -13,7 +13,7 @@ func (repo *Repo) ValidGoSum() error {
if !repo.Exists("go.mod") {
return errors.New("ValidGoSum() go.mod is missing")
}
- if repo.GoPrimitive {
+ if repo.GoInfo.GoPrimitive {
if !repo.Exists("go.mod") {
return errors.New("GoPrimitive == true, but go.mod is missing")
}
diff --git a/isPrimitive.go b/isPrimitive.go
index 7755cfb..a632e1a 100644
--- a/isPrimitive.go
+++ b/isPrimitive.go
@@ -51,13 +51,13 @@ func (repo *Repo) IsPrimitive() (bool, error) {
}
if parts[0] == "go" {
if parts[1] != "1.21" {
- log.Log(GITPBWARN, "go not set to 1.21 for", repo.GoPath)
- // return false, errors.New("go not set to 1.21 for " + repo.GoPath)
+ log.Log(GITPBWARN, "go not set to 1.21 for", repo.GetGoPath())
+ // return false, errors.New("go not set to 1.21 for " + repo.GetGoPath())
}
}
}
}
- repo.GoPrimitive = true
+ repo.GoInfo.GoPrimitive = true
repo.GoDeps = nil
return true, nil
}
diff --git a/makePatches.go b/makePatches.go
index a94b5b1..104ba47 100644
--- a/makePatches.go
+++ b/makePatches.go
@@ -81,7 +81,7 @@ func (repo *Repo) GetMasterPatches() (int, []*Patch) {
}
func (all *Repos) MakePatchset(setdir string) bool {
- loop := all.SortByGoPath()
+ loop := all.SortByFullPath()
for loop.Scan() {
repo := loop.Next()
log.Info("repo", repo.GetGoPath())
diff --git a/reload.go b/reload.go
index 7c910d3..0168ea8 100644
--- a/reload.go
+++ b/reload.go
@@ -13,36 +13,15 @@ func (repo *Repo) Reload() error {
repo.GoDeps = new(GoDeps)
repo.ParseGoSum()
- if repo.GoInfo != nil {
- repo.ReloadGo()
- }
-
repo.setLastTag()
repo.setCurrentBranchName()
+ repo.setRepoType()
// everything has been checked, now save the mtime's
repo.RepoChanged()
return nil
}
-func (repo *Repo) ReloadGo() error {
- repo.GoPlugin = false
- repo.GoProtobuf = false
- repo.GoLibrary = false
- repo.GoBinary = false
- switch repo.goListRepoType() {
- case "plugin":
- repo.GoPlugin = true
- case "protobuf":
- repo.GoProtobuf = true
- case "library":
- repo.GoLibrary = true
- case "binary":
- repo.GoBinary = true
- }
- return nil
-}
-
func (repo *Repo) SetDevelBranchName(bname string) {
repo.DevelBranchName = bname
}
@@ -82,7 +61,7 @@ func (repo *Repo) setCurrentBranchName() {
r := repo.RunQuiet([]string{"git", "branch", "--show-current"})
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Log(GITPBWARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GoPath)
+ log.Log(GITPBWARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GetGoPath())
log.Log(GITPBWARN, "GetCurrentBranchName() output might have worked anyway:", output)
}
repo.CurrentBranchName = strings.TrimSpace(output)
@@ -98,7 +77,7 @@ func (repo *Repo) setCurrentBranchVersion() {
r := repo.RunQuiet([]string{"git", "describe", "--tags", "--always"})
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Log(GITPBWARN, "GetCurrentBranchVersion() not in a git repo?", r.Error, repo.GoPath)
+ log.Log(GITPBWARN, "GetCurrentBranchVersion() not in a git repo?", r.Error, repo.GetGoPath())
log.Log(GITPBWARN, "GetCurrentBranchVersion() output might have worked anyway:", output)
}
repo.CurrentBranchVersion = strings.TrimSpace(output)
diff --git a/reloadIsTracked.go b/reloadIsTracked.go
index 9e44b2a..bdb6138 100644
--- a/reloadIsTracked.go
+++ b/reloadIsTracked.go
@@ -40,12 +40,12 @@ func (repo *Repo) RepoIgnoresGoMod() error {
repo.GoInfo.GitIgnoresGoSum = false
file := "go.mod"
if tracked, err := repo.isTracked(file); err != nil {
- msg := fmt.Sprintf("%s Error checking if %s tracked: %v\n", repo.GoPath, file, err)
+ msg := fmt.Sprintf("%s Error checking if %s tracked: %v\n", repo.GetGoPath(), file, err)
log.Info("gitpb:", msg)
return err
} else {
if tracked {
- msg := fmt.Sprintf("%s %s is tracked by Git.\n", repo.GoPath, file)
+ msg := fmt.Sprintf("%s %s is tracked by Git.\n", repo.GetGoPath(), file)
log.Info("gitpb:", msg)
return errors.New(msg)
}
@@ -53,18 +53,18 @@ func (repo *Repo) RepoIgnoresGoMod() error {
if ignored, err := repo.isIgnored(file); err != nil {
if err != nil {
- msg := fmt.Sprintf("%s Error checking if ignored: %v\n", repo.GoPath, err)
+ msg := fmt.Sprintf("%s Error checking if ignored: %v\n", repo.GetGoPath(), err)
log.Info("gitpb:", msg)
return err
}
} else {
if ignored {
- fmt.Printf("%s %s is ignored by Git.\n", repo.GoPath, file)
+ fmt.Printf("%s %s is ignored by Git.\n", repo.GetGoPath(), file)
repo.GoInfo.GitIgnoresGoSum = true
return nil
}
}
- msg := fmt.Sprintf("%s %s is neither tracked nor ignored by Git.\n", repo.GoPath, file)
+ msg := fmt.Sprintf("%s %s is neither tracked nor ignored by Git.\n", repo.GetGoPath(), file)
// this means, if you make a go.mod file, it'll add it to the repo to be tracked
// so you need to either add it to .gitignore (this is what should happen)
// or accept you want an auto-generated file to put endless garbage in your git repo
diff --git a/reloadRepoType.go b/reloadRepoType.go
index 52846d2..e1c1735 100644
--- a/reloadRepoType.go
+++ b/reloadRepoType.go
@@ -9,26 +9,58 @@ import (
"go.wit.com/log"
)
-func (repo *Repo) RepoType() string {
+func (repo *Repo) GetRepoType() string {
if repo == nil {
return "nil"
}
- if repo.GetGoPlugin() {
+ if repo.GoInfo == nil {
+ log.Warn("gitpb.RepoType() plugin was not set correctly")
+ log.Warn("gitpb.RepoType() plugin was not set correctly")
+ log.Warn("gitpb.RepoType() plugin was not set correctly")
+ repo.GoInfo = new(GoInfo)
+ repo.setRepoType()
+ }
+
+ if repo.GoInfo.GoPlugin {
return "plugin"
}
- if repo.GetGoBinary() {
+ if repo.GoInfo.GoProtobuf {
+ return "protobuf"
+ }
+ if repo.GoInfo.GoBinary {
if repo.Exists(".plugin") {
+ log.Warn("gitpb.RepoType() plugin was not set correctly")
+ repo.GoInfo.GoPlugin = true
return "plugin"
}
return "binary"
}
+ if repo.GoInfo.GoLibrary {
+ return "library"
+ }
+ return "err"
+}
+
+func (repo *Repo) setRepoType() {
+ if repo == nil {
+ return
+ }
+ if repo.Exists(".plugin") {
+ repo.GoInfo.GoPlugin = true
+ return
+ }
if ok, _, _ := repo.IsProtobuf(); ok {
- return "protobuf"
+ repo.GoInfo.GoProtobuf = true
+ return
}
- if repo.GetGoLibrary() {
- return "library"
+ switch repo.goListRepoType() {
+ case "binary":
+ repo.GoInfo.GoBinary = true
+ return
+ case "library":
+ repo.GoInfo.GoLibrary = true
+ return
}
- return ""
}
func (repo *Repo) goListRepoType() string {
diff --git a/repo.new.go b/repo.new.go
index ca224e2..8ebe78c 100644
--- a/repo.new.go
+++ b/repo.new.go
@@ -16,8 +16,8 @@ func (all *Repos) NewGoRepo(fullpath string, gopath string) (*Repo, error) {
if gopath == "" {
return nil, errors.New("blank gopath")
}
- if r := all.FindByGoPath(gopath); r != nil {
- log.Info("gitpb.NewGoPath() already has gopath", r.GoPath)
+ if r := all.FindByFullPath(fullpath); r != nil {
+ log.Info("gitpb.NewGoPath() already has gopath", r.GetGoPath())
log.Info("gitpb.NewGoPath() already has FullPath", r.FullPath)
// already had this gopath
return r, errors.New("gitpb.NewGoPath() duplicate gopath " + gopath)
@@ -31,13 +31,15 @@ func (all *Repos) NewGoRepo(fullpath string, gopath string) (*Repo, error) {
newr.GoInfo = new(GoInfo)
newr.GoInfo.GoPath = gopath
+ // everything happens in here
+ newr.Reload()
- if all.AppendUniqueGoPath(&newr) {
+ if all.AppendUniqueFullPath(&newr) {
// worked
return &newr, nil
} else {
// this is dumb, probably never happens. todo: use Repos.Lock()
- if r := all.FindByGoPath(gopath); r != nil {
+ if r := all.FindByFullPath(fullpath); r != nil {
// already had this gopath
return r, errors.New("gitpb.NewGoPath() AppendUnique() failed but Find() worked" + gopath)
}
@@ -45,3 +47,18 @@ func (all *Repos) NewGoRepo(fullpath string, gopath string) (*Repo, error) {
// todo: use Repos.Lock()
return nil, errors.New("repo gitpb.NewGoPath() should never have gotten here " + gopath)
}
+
+// enforces GoPath is unique
+func (all *Repos) AppendUniqueGoPath(newr *Repo) bool {
+ all.Lock.RLock()
+ defer all.Lock.RUnlock()
+
+ for _, r := range all.Repos {
+ if r.GoInfo.GoPath == newr.GoInfo.GoPath {
+ return false
+ }
+ }
+
+ all.Repos = append(all.Repos, newr)
+ return true
+}
diff --git a/repo.proto b/repo.proto
index 6730af9..9fcb0c6 100644
--- a/repo.proto
+++ b/repo.proto
@@ -13,35 +13,25 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time
message Repo { // `autogenpb:marshal`
string fullPath = 1; // `autogenpb:unique` // the actual path to the .git directory: '/home/devel/golang.org/x/tools'
- google.protobuf.Timestamp lastPull = 2; // last time a git pull was done
string masterBranchName = 3; // git 'main' or 'master' branch name
string develBranchName = 4; // whatever the git 'devel' branch name is
string userBranchName = 5; // whatever your username branch is
- GitTags tags = 6; // known tags
- string goPath = 7; // `autogenpb:unique` // the logical path as used by golang: 'go.wit.com/apps/helloworld'
- bool goLibrary = 8; // is this a golang library?
- bool goBinary = 9; // is this a golang binary?
- bool goPrimitive = 10; // if this is a golang primitive (only has go.mod)
- bool goPlugin = 11; // is this a golang plugin?
- GoDeps goDeps = 12; // what is in the go.sum file
- google.protobuf.Timestamp lastGoDep = 13; // last time go.sum was processed
- bool dirty = 14; // if git says things have been changed
- GoDeps published = 15; // the last published go.mod/go.sum
- string targetVersion = 16; // useful during the package release process
- bool readOnly = 17; // tracks access to 'git push'
- string URL = 18; // the URL. amazingly I didn't add this earlier. duh.
- bool goProtobuf = 19; // autogen go files from .proto
- string desc = 20; // what is this repo?
- bytes goMod = 21; // the last go.mod file
- bytes goSum = 22; // the last go.sum file
- google.protobuf.Timestamp mtimeGitDir = 23; // mtime for ./git
- google.protobuf.Timestamp mtimeGitHead = 24; // mtime for ./git/HEAD // these two mtimes allow really fast checks to see if git has changed
- GitTimes times = 25; // store all the mtime values here. these are temporary
- GoInfo goInfo = 26; // put all the go specifcs here
- string stateChange = 27; // reason for state change
- string lastTag = 28; // the oldest tag
- string currentBranchName = 29; // the branch currently checked out
- string currentBranchVersion = 30; // the branch currently checked out
+ bool dirty = 6; // if git says things have been changed
+ string URL = 7; // the URL
+ GitTags tags = 8; // known tags
+ GitTimes times = 9; // store all the mtime values here. these are temporary
+ GoInfo goInfo = 10; // put all the go specifcs here
+ GoDeps goDeps = 11; // what is in the go.sum file
+ string currentBranchName = 12; // the branch currently checked out
+ string currentBranchVersion = 13; // the branch currently checked out
+ string lastTag = 14; // the oldest tag
+ string targetVersion = 15; // useful during the package release process
+ bool readOnly = 16; // tracks access to 'git push'
+ string desc = 17; // what is this repo?
+ string stateChange = 18; // reason for state change
+ string masterVersion = 19; // just store this for now
+ string develVersion = 20; //
+ string userVersion = 21; //
}
message Repos { // `autogenpb:marshal`
@@ -59,6 +49,7 @@ message GitTimes {
google.protobuf.Timestamp mtimeHead = 5; // mtime for ./git/HEAD // these two mtimes allow really fast checks to see if git has changed
google.protobuf.Timestamp mtimeIndex = 6; // mtime for ./git/HEAD // probably always in sync with HEAD
google.protobuf.Timestamp mtimeFetch = 7; // mtime for ./git/FETCH_HEAD // last time 'git fetch' or 'git pull' was run on current branch?
+ google.protobuf.Timestamp lastGoDep = 8; // mtime for last go.sum scan
}
// this is probably better. think about moving to this instead
diff --git a/rill.go b/rill.go
index 7b4bb87..78c1de0 100644
--- a/rill.go
+++ b/rill.go
@@ -23,7 +23,7 @@ func (repo *Repo) GitPull() cmd.Status {
var result cmd.Status
result.Exit = 21
result.Error = ErrorGitPullOnLocal
- // log.Info("git pull skipped on local only branch", repo.GoPath)
+ // log.Info("git pull skipped on local only branch", repo.GetGoPath())
return result
}
var cmd []string
@@ -87,7 +87,7 @@ func (all *Repos) RillGitPull(part1 int, part2 int) map[*Repo]cmd.Status {
*/
var result cmd.Status
result = repo.GitPull()
- log.Info("git pull", strings.Join(result.Stdout, " "), repo.GoPath)
+ log.Info("git pull", strings.Join(result.Stdout, " "), repo.GetGoPath())
lock.Lock()
defer lock.Unlock()
allerr[repo] = result
diff --git a/shell.go b/shell.go
index ce000e5..b7c0018 100644
--- a/shell.go
+++ b/shell.go
@@ -55,7 +55,7 @@ func (repo *Repo) RunStrict(cmd []string) error {
func (repo *Repo) StrictRun(cmd []string) error {
result := repo.RunQuiet(cmd)
if result.Error != nil {
- log.Warn(repo.GoPath, cmd, "wow. golang is cool. an os.Error:", result.Error)
+ log.Warn(repo.GetGoPath(), cmd, "wow. golang is cool. an os.Error:", result.Error)
return result.Error
}
if result.Exit != 0 {