diff options
author | Michael Muré <batolettre@gmail.com> | 2019-02-24 23:05:03 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-03-01 22:52:54 +0100 |
commit | c235d89d36500e58e3bcadda94e9cab06023dd55 (patch) | |
tree | c2ee84316886cca3e439dbc12f64d6a06ddd7c18 /identity/identity.go | |
parent | 46beb4b886761ff69abe2ce45c2498a4fafe50d9 (diff) | |
download | git-bug-c235d89d36500e58e3bcadda94e9cab06023dd55.tar.gz |
commands: show the last modification time in "user"
Diffstat (limited to 'identity/identity.go')
-rw-r--r-- | identity/identity.go | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/identity/identity.go b/identity/identity.go index 720a1ebd..3dddfaec 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -8,6 +8,7 @@ import ( "strings" "time" + "github.com/MichaelMure/git-bug/util/timestamp" "github.com/pkg/errors" "github.com/MichaelMure/git-bug/repository" @@ -33,10 +34,11 @@ type Identity struct { // Id used as unique identifier id string - lastCommit git.Hash - // all the successive version of the identity versions []*Version + + // not serialized + lastCommit git.Hash } func NewIdentity(name string, email string) *Identity { @@ -498,13 +500,6 @@ func (i *Identity) Keys() []Key { return i.lastVersion().keys } -// IsProtected return true if the chain of git commits started to be signed. -// If that's the case, only signed commit with a valid key for this identity can be added. -func (i *Identity) IsProtected() bool { - // Todo - return false -} - // ValidKeysAtTime return the set of keys valid at a given lamport time func (i *Identity) ValidKeysAtTime(time lamport.Time) []Key { var result []Key @@ -535,6 +530,23 @@ func (i *Identity) DisplayName() string { panic("invalid person data") } +// IsProtected return true if the chain of git commits started to be signed. +// If that's the case, only signed commit with a valid key for this identity can be added. +func (i *Identity) IsProtected() bool { + // Todo + return false +} + +// LastModificationLamportTime return the Lamport time at which the last version of the identity became valid. +func (i *Identity) LastModificationLamport() lamport.Time { + return i.lastVersion().time +} + +// LastModification return the timestamp at which the last version of the identity became valid. +func (i *Identity) LastModification() timestamp.Timestamp { + return timestamp.Timestamp(i.lastVersion().unixTime) +} + // SetMetadata store arbitrary metadata along the last defined Version. // If the Version has been commit to git already, it won't be overwritten. func (i *Identity) SetMetadata(key string, value string) { |