diff options
author | Michael Muré <batolettre@gmail.com> | 2020-01-24 00:30:13 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-08 17:19:57 +0100 |
commit | 74e91144105790cc997c1d79a7f638e1e3a1f3f8 (patch) | |
tree | 33ef7b3cf547afc10b613e5d4de087ca0439232b /identity/identity.go | |
parent | 8da522d97af3dcaca8a8424e3541705c69779d6f (diff) | |
download | git-bug-74e91144105790cc997c1d79a7f638e1e3a1f3f8.tar.gz |
more more wip
Diffstat (limited to 'identity/identity.go')
-rw-r--r-- | identity/identity.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/identity/identity.go b/identity/identity.go index 655afd31..c33a8818 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -275,7 +275,7 @@ type Mutator struct { Name string Email string AvatarUrl string - Keys []Key + Keys []*Key } // Mutate allow to create a new version of the Identity @@ -507,13 +507,13 @@ func (i *Identity) AvatarUrl() string { } // Keys return the last version of the valid keys -func (i *Identity) Keys() []Key { +func (i *Identity) Keys() []*Key { return i.lastVersion().keys } // ValidKeysAtTime return the set of keys valid at a given lamport time -func (i *Identity) ValidKeysAtTime(time lamport.Time) []Key { - var result []Key +func (i *Identity) ValidKeysAtTime(time lamport.Time) []*Key { + var result []*Key for _, v := range i.versions { if v.time > time { @@ -550,11 +550,11 @@ func (i *Identity) LastModification() timestamp.Timestamp { } // SetMetadata store arbitrary metadata along the last not-commit Version. -// If the Version has been commit to git already, a new version is added and will need to be +// If the Version has been commit to git already, a new identical version is added and will need to be // commit. func (i *Identity) SetMetadata(key string, value string) { if i.lastVersion().commitHash != "" { - + i.versions = append(i.versions, i.lastVersion().Clone()) } i.lastVersion().SetMetadata(key, value) } @@ -588,3 +588,9 @@ func (i *Identity) MutableMetadata() map[string]string { return metadata } + +// addVersionForTest add a new version to the identity +// Only for testing ! +func (i *Identity) addVersionForTest(version *Version) { + i.versions = append(i.versions, version) +} |