summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorforge <[email protected]>2025-10-06 12:17:32 -0500
committerJeff Carr <[email protected]>2025-10-07 02:28:25 -0500
commit6bd10cf29ba546e80803874e0499d17aa2223330 (patch)
treec2ab43b5b07fe3fa9e9c313a5dc6f1895e98ccfa
parentcd5d073138cd52e21d3cdf751b39260ddedd4aba (diff)
wrong logic
-rw-r--r--config.go13
-rw-r--r--tableMissing.go30
2 files changed, 38 insertions, 5 deletions
diff --git a/config.go b/config.go
index ad0c4c1..3068869 100644
--- a/config.go
+++ b/config.go
@@ -23,7 +23,11 @@ func (all *Repos) ConfigSave(fname string) error {
log.Infof("ConfigSave() filename '%s' invalid\n", fname)
return log.Errorf("ConfigSave() filename '%s' invalid\n", fname)
}
+ return all.Save(fname)
+}
+// bypass name check "repos.pb"
+func (all *Repos) Save(fname string) error {
data, err := all.Marshal()
if err != nil {
log.Info("gitpb proto.Marshal() failed len", len(data), err)
@@ -90,6 +94,7 @@ func (all *Repos) ConfigLoad(cfgname string) error {
if data, err = loadFile(cfgname); err != nil {
// something went wrong loading the file
// all.sampleConfig() // causes nil panic
+ log.Info("Repos ConfigLoad() failed", cfgname, err)
return err
}
// this means the forge.pb file exists and was read
@@ -129,13 +134,11 @@ func (all *Repos) sampleConfig() {
func loadFile(fullname string) ([]byte, error) {
data, err := os.ReadFile(fullname)
if errors.Is(err, os.ErrNotExist) {
- // if file does not exist, just return nil. this
- // will cause ConfigLoad() to try the next config file like "forge.text"
- // because the user might want to edit the .config by hand
- return nil, nil
+ // the file does not exist
+ return nil, err
}
if err != nil {
- // log.Info("open config file :", err)
+ log.Info(fullname, "permission error? error =", err)
return nil, err
}
return data, nil
diff --git a/tableMissing.go b/tableMissing.go
new file mode 100644
index 0000000..bf3c2bc
--- /dev/null
+++ b/tableMissing.go
@@ -0,0 +1,30 @@
+// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
+
+package gitpb
+
+func (pb *Repos) PrintMissingTable() {
+ t := pb.NewTable("missing repos table")
+ t.NewUuid()
+
+ var col *RepoFunc
+
+ col = t.AddNamespace()
+ col.Width = 45
+
+ col = t.AddURL()
+ col.Width = -1
+
+ /*
+ col = t.AddStringFunc("hash", func(r *gitpb.Repo) string {
+ if r.Tags == nil {
+ return "nil"
+ }
+ if r.Tags.Master == nil {
+ return "nil"
+ }
+ return r.Tags.Master.Hash
+ })
+ col.Width = 6
+ */
+ t.PrintTable()
+}