1package cache
2
3import (
4 "github.com/MichaelMure/git-bug/identity"
5)
6
7// IdentityCache is a wrapper around an Identity. It provide multiple functions:
8type IdentityCache struct {
9 *identity.Identity
10 repoCache *RepoCache
11}
12
13func NewIdentityCache(repoCache *RepoCache, id *identity.Identity) *IdentityCache {
14 return &IdentityCache{
15 Identity: id,
16 repoCache: repoCache,
17 }
18}
19
20func (i *IdentityCache) Commit() error {
21 return i.Identity.Commit(i.repoCache.repo)
22}
23
24func (i *IdentityCache) CommitAsNeeded() error {
25 return i.Identity.CommitAsNeeded(i.repoCache.repo)
26}