LocalVersion is unavailable until after AddRepo (fixes #154)

This commit is contained in:
Jakob Borg 2014-09-22 14:03:58 +02:00
parent 39cf269d6b
commit 434ecdac6b
2 changed files with 2 additions and 4 deletions

View File

@ -431,8 +431,8 @@ nextRepo:
if repo.Invalid != "" { if repo.Invalid != "" {
continue continue
} }
repo.Directory = expandTilde(repo.Directory) repo.Directory = expandTilde(repo.Directory)
m.AddRepo(repo)
fi, err := os.Stat(repo.Directory) fi, err := os.Stat(repo.Directory)
if m.LocalVersion(repo.ID) > 0 { if m.LocalVersion(repo.ID) > 0 {
@ -458,8 +458,6 @@ nextRepo:
cfg.Repositories[i].Invalid = err.Error() cfg.Repositories[i].Invalid = err.Error()
continue nextRepo continue nextRepo
} }
m.AddRepo(repo)
} }
// GUI // GUI

View File

@ -1044,7 +1044,7 @@ func (m *Model) LocalVersion(repo string) uint64 {
fs, ok := m.repoFiles[repo] fs, ok := m.repoFiles[repo]
if !ok { if !ok {
return 0 panic("bug: LocalVersion called for nonexistent repo " + repo)
} }
ver := fs.LocalVersion(protocol.LocalNodeID) ver := fs.LocalVersion(protocol.LocalNodeID)