diff options
author | Michael Muré <batolettre@gmail.com> | 2019-04-11 20:04:44 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-04-11 20:04:44 +0200 |
commit | 5eeeae7cdf24083277076041c4e8cdc6b4737fda (patch) | |
tree | 0e1e8b6a44650a146a296b3710757c309d420617 /cache | |
parent | 4fac4abbcd357b9a8a99222af15a7c5fca9f5633 (diff) | |
download | git-bug-5eeeae7cdf24083277076041c4e8cdc6b4737fda.tar.gz |
commands: fix ls not displaying the new Identities properly
Diffstat (limited to 'cache')
-rw-r--r-- | cache/bug_excerpt.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cache/bug_excerpt.go b/cache/bug_excerpt.go index d78def4e..8e9e5e37 100644 --- a/cache/bug_excerpt.go +++ b/cache/bug_excerpt.go @@ -2,6 +2,7 @@ package cache import ( "encoding/gob" + "fmt" "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/identity" @@ -45,6 +46,19 @@ type LegacyAuthorExcerpt struct { Login string } +func (l LegacyAuthorExcerpt) DisplayName() string { + switch { + case l.Name == "" && l.Login != "": + return l.Login + case l.Name != "" && l.Login == "": + return l.Name + case l.Name != "" && l.Login != "": + return fmt.Sprintf("%s (%s)", l.Name, l.Login) + } + + panic("invalid person data") +} + func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt { participantsIds := make([]string, len(snap.Participants)) for i, participant := range snap.Participants { |