aboutsummaryrefslogtreecommitdiffstats
path: root/cache/repo_cache.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache/repo_cache.go')
-rw-r--r--cache/repo_cache.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index f2e1c7d0..83ce4802 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -29,7 +29,8 @@ const identityCacheFile = "identity-cache"
// 1: original format
// 2: added cache for identities with a reference in the bug cache
-const formatVersion = 2
+// 3: CreateUnixTime --> createUnixTime, EditUnixTime --> editUnixTime
+const formatVersion = 3
type ErrInvalidCacheFormat struct {
message string
@@ -99,10 +100,13 @@ func NewNamedRepoCache(r repository.ClockedRepo, name string) (*RepoCache, error
if err == nil {
return c, nil
}
- if _, ok := err.(ErrInvalidCacheFormat); ok {
+ if _, ok := err.(ErrInvalidCacheFormat); !ok {
+ // Actual error
return nil, err
}
+ // We have an outdated cache format, rebuilding it.
+
err = c.buildCache()
if err != nil {
return nil, err
@@ -254,7 +258,7 @@ func (c *RepoCache) loadBugCache() error {
return err
}
- if aux.Version != 2 {
+ if aux.Version != formatVersion {
return ErrInvalidCacheFormat{
message: fmt.Sprintf("unknown cache format version %v", aux.Version),
}
@@ -286,7 +290,7 @@ func (c *RepoCache) loadIdentityCache() error {
return err
}
- if aux.Version != 2 {
+ if aux.Version != formatVersion {
return ErrInvalidCacheFormat{
message: fmt.Sprintf("unknown cache format version %v", aux.Version),
}