diff options
author | Michael Muré <batolettre@gmail.com> | 2020-06-25 23:18:17 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-06-25 23:18:17 +0200 |
commit | aab3a04d0c4ddbf97d589ba9048a539c6d7186e9 (patch) | |
tree | 5db59215d2c9559c2d33d1a2a2010270a88d669d /cache/repo_cache.go | |
parent | 1d06244c82b18959878cf199cd8dd500bbc46aa7 (diff) | |
download | git-bug-aab3a04d0c4ddbf97d589ba9048a539c6d7186e9.tar.gz |
bug: harmonize how time are used, fix some issues in command special formats
This assume that the convertion from time.Time <--> Unix timestamp is lossless which seems to be.
Diffstat (limited to 'cache/repo_cache.go')
-rw-r--r-- | cache/repo_cache.go | 12 |
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), } |