diff --git a/config.go b/config.go index e59c873..53cc288 100644 --- a/config.go +++ b/config.go @@ -56,7 +56,25 @@ func (all *Repos) ConfigLoad() error { all.sampleConfig() // causes nil panic return errors.New("gitpb.ConfigLoad() repos.pb is empty") } - return all.Unmarshal(data) + 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 +} + +func deleteProtobufFile(filename string) { + log.Log(WARN, "The protobuf file format has changed for", filename) + log.Log(WARN, "You must delete", filename) + log.Log(WARN, "This file will be recreated") + os.Exit(-1) } func (all *Repos) sampleConfig() {