MCPcopy Create free account
hub / github.com/git-bug/git-bug / finishIdentity

Method finishIdentity

cache/identity_subcache.go:99–125  ·  view source on GitHub ↗
(i *identity.Identity, metadata map[string]string)

Source from the content-addressed store, hash-verified

97}
98
99func (c *RepoCacheIdentity) finishIdentity(i *identity.Identity, metadata map[string]string) (*IdentityCache, error) {
100 for key, value := range metadata {
101 i.SetMetadata(key, value)
102 }
103
104 err := i.Commit(c.repo)
105 if err != nil {
106 return nil, err
107 }
108
109 c.mu.Lock()
110 if _, has := c.cached[i.Id()]; has {
111 return nil, fmt.Errorf("identity %s already exist in the cache", i.Id())
112 }
113
114 cached := NewIdentityCache(i, c.repo, c.entityUpdated)
115 c.cached[i.Id()] = cached
116 c.mu.Unlock()
117
118 // force the write of the excerpt
119 err = c.entityUpdated(i.Id())
120 if err != nil {
121 return nil, err
122 }
123
124 return cached, nil
125}

Callers 2

NewRawMethod · 0.95
NewFromGitUserRawMethod · 0.95

Calls 7

NewIdentityCacheFunction · 0.85
ErrorfMethod · 0.80
entityUpdatedMethod · 0.80
SetMetadataMethod · 0.65
CommitMethod · 0.65
LockMethod · 0.65
IdMethod · 0.65

Tested by

no test coverage detected