diff options
author | Michael Muré <batolettre@gmail.com> | 2019-02-24 18:49:12 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-03-01 22:52:53 +0100 |
commit | 46beb4b886761ff69abe2ce45c2498a4fafe50d9 (patch) | |
tree | 2722505d859d93a309e6fcee40af7812c74d1220 /identity | |
parent | 475b7b4c490bc3729772932f2d7bbcabb8f781a7 (diff) | |
download | git-bug-46beb4b886761ff69abe2ce45c2498a4fafe50d9.tar.gz |
identity: another round of cleanups
Diffstat (limited to 'identity')
-rw-r--r-- | identity/identity.go | 7 | ||||
-rw-r--r-- | identity/identity_stub.go | 2 | ||||
-rw-r--r-- | identity/interface.go | 4 | ||||
-rw-r--r-- | identity/version.go | 10 |
4 files changed, 12 insertions, 11 deletions
diff --git a/identity/identity.go b/identity/identity.go index d57e8ce0..720a1ebd 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -24,7 +24,7 @@ const idLength = 40 const humanIdLength = 7 var ErrNonFastForwardMerge = errors.New("non fast-forward identity merge") -var ErrNoIdentitySet = errors.New("user identity first needs to be created using \"git bug user create\"") +var ErrNoIdentitySet = errors.New("user identity first needs to be created using \"git bug user create\" or \"git bug user adopt\"") var ErrMultipleIdentitiesSet = errors.New("multiple user identities set") var _ Interface = &Identity{} @@ -391,11 +391,6 @@ func (i *Identity) Merge(repo repository.Repo, other *Identity) (bool, error) { return false, errors.New("can't merge identities that has never been stored") } - /*ancestor, err := repo.FindCommonAncestor(i.lastCommit, other.lastCommit) - if err != nil { - return false, errors.Wrap(err, "can't find common ancestor") - }*/ - modified := false for j, otherVersion := range other.versions { // if there is more version in other, take them diff --git a/identity/identity_stub.go b/identity/identity_stub.go index 1bfc18d0..b6bc0ab0 100644 --- a/identity/identity_stub.go +++ b/identity/identity_stub.go @@ -40,10 +40,12 @@ func (i *IdentityStub) UnmarshalJSON(data []byte) error { return nil } +// Id return the Identity identifier func (i *IdentityStub) Id() string { return i.id } +// HumanId return the Identity identifier truncated for human consumption func (i *IdentityStub) HumanId() string { return FormatHumanID(i.Id()) } diff --git a/identity/interface.go b/identity/interface.go index d5c80543..49395ab1 100644 --- a/identity/interface.go +++ b/identity/interface.go @@ -14,12 +14,16 @@ type Interface interface { // Name return the last version of the name Name() string + // Email return the last version of the email Email() string + // Login return the last version of the login Login() string + // AvatarUrl return the last version of the Avatar URL AvatarUrl() string + // Keys return the last version of the valid keys Keys() []Key diff --git a/identity/version.go b/identity/version.go index 1259ae9c..95530767 100644 --- a/identity/version.go +++ b/identity/version.go @@ -51,11 +51,11 @@ type VersionJSON struct { Time lamport.Time `json:"time"` UnixTime int64 `json:"unix_time"` - Name string `json:"name"` - Email string `json:"email"` - Login string `json:"login"` - AvatarUrl string `json:"avatar_url"` - Keys []Key `json:"pub_keys"` + Name string `json:"name,omitempty"` + Email string `json:"email,omitempty"` + Login string `json:"login,omitempty"` + AvatarUrl string `json:"avatar_url,omitempty"` + Keys []Key `json:"pub_keys,omitempty"` Nonce []byte `json:"nonce,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` } |