aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-06-26 00:58:38 +0200
committerMichael Muré <batolettre@gmail.com>2020-06-26 00:58:38 +0200
commitc326007d01b623bcf883f74f31fc3e5ab3078396 (patch)
tree610ff7e381ef99827dc1b1dbc9ae4ea137fe5e21 /cache
parentaab3a04d0c4ddbf97d589ba9048a539c6d7186e9 (diff)
downloadgit-bug-c326007d01b623bcf883f74f31fc3e5ab3078396.tar.gz
fix cache not rebuilding properly
Diffstat (limited to 'cache')
-rw-r--r--cache/repo_cache.go23
1 files changed, 3 insertions, 20 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index 83ce4802..e70904df 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -32,14 +32,6 @@ const identityCacheFile = "identity-cache"
// 3: CreateUnixTime --> createUnixTime, EditUnixTime --> editUnixTime
const formatVersion = 3
-type ErrInvalidCacheFormat struct {
- message string
-}
-
-func (e ErrInvalidCacheFormat) Error() string {
- return e.message
-}
-
var _ repository.RepoCommon = &RepoCache{}
// RepoCache is a cache for a Repository. This cache has multiple functions:
@@ -100,13 +92,8 @@ func NewNamedRepoCache(r repository.ClockedRepo, name string) (*RepoCache, error
if err == nil {
return c, nil
}
- if _, ok := err.(ErrInvalidCacheFormat); !ok {
- // Actual error
- return nil, err
- }
-
- // We have an outdated cache format, rebuilding it.
+ // Cache is either missing, broken or outdated. Rebuilding.
err = c.buildCache()
if err != nil {
return nil, err
@@ -259,9 +246,7 @@ func (c *RepoCache) loadBugCache() error {
}
if aux.Version != formatVersion {
- return ErrInvalidCacheFormat{
- message: fmt.Sprintf("unknown cache format version %v", aux.Version),
- }
+ return fmt.Errorf("unknown cache format version %v", aux.Version)
}
c.bugExcerpts = aux.Excerpts
@@ -291,9 +276,7 @@ func (c *RepoCache) loadIdentityCache() error {
}
if aux.Version != formatVersion {
- return ErrInvalidCacheFormat{
- message: fmt.Sprintf("unknown cache format version %v", aux.Version),
- }
+ return fmt.Errorf("unknown cache format version %v", aux.Version)
}
c.identitiesExcerpts = aux.Excerpts