summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'config.go')
-rw-r--r--config.go39
1 files changed, 2 insertions, 37 deletions
diff --git a/config.go b/config.go
index 9e10d20..ad0c4c1 100644
--- a/config.go
+++ b/config.go
@@ -12,7 +12,7 @@ import (
"go.wit.com/log"
)
-// write to ~/.config/forge/ unless ENV{FORGE_REPOSDIR} is set
+// write the repos.pb file
func (all *Repos) ConfigSave(fname string) error {
if all == nil {
log.Warn("gitpb repos == nil")
@@ -82,42 +82,7 @@ func (all *Repos) tryValidate() error {
return nil
}
-// 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) ConfigLoadOld() error {
- if os.Getenv("FORGE_REPOSDIR") == "" {
- homeDir, _ := os.UserHomeDir()
- fullpath := filepath.Join(homeDir, ".config/forge")
- os.Setenv("FORGE_REPOSDIR", fullpath)
- }
- var data []byte
- var err error
-
- cfgname := filepath.Join(os.Getenv("FORGE_REPOSDIR"), "repos.pb")
- if data, err = loadFile(cfgname); err != nil {
- // something went wrong loading the file
- // all.sampleConfig() // causes nil panic
- return err
- }
- // this means the forge.pb file exists and was read
- if len(data) == 0 {
- return errors.New("gitpb.ConfigLoad() repos.pb is empty")
- }
- err = all.Unmarshal(data)
- test := NewRepos()
- if test.Uuid != all.Uuid {
- log.Log(WARN, "uuids do not match", test.Uuid, all.Uuid)
- deleteProtobufFile(cfgname)
- }
- if test.Version != all.Version {
- log.Log(WARN, "versions do not match", test.Version, all.Version)
- deleteProtobufFile(cfgname)
- }
- log.Log(INFO, cfgname, "protobuf versions and uuid match", all.Uuid, all.Version)
- return err
-}
-
+// load the repos.pb file.
func (all *Repos) ConfigLoad(cfgname string) error {
var data []byte
var err error