mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 17:51:44 +03:00
fix cache not rebuilding properly
This commit is contained in:
parent
aab3a04d0c
commit
c326007d01
23
cache/repo_cache.go
vendored
23
cache/repo_cache.go
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user