feat(ui): show committer in blame

Ayman Bagabas created

Change summary

pkg/ui/pages/repo/files.go | 4 +++-
pkg/ui/styles/styles.go    | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)

Detailed changes

pkg/ui/pages/repo/files.go 🔗

@@ -497,9 +497,11 @@ func renderBlame(c common.Common, f *FileItem, b *gitm.Blame) string {
 		if commit == nil {
 			break
 		}
-		line := fmt.Sprintf("%s %s",
+		who := fmt.Sprintf("%s <%s>", commit.Author.Name, commit.Author.Email)
+		line := fmt.Sprintf("%s %s %s",
 			c.Styles.Tree.Blame.Hash.Render(commit.ID.String()[:7]),
 			c.Styles.Tree.Blame.Message.Render(commit.Summary()),
+			c.Styles.Tree.Blame.Who.Render(who),
 		)
 		if line != prev {
 			lines = append(lines, line)

pkg/ui/styles/styles.go 🔗

@@ -126,6 +126,7 @@ type Styles struct {
 		Blame       struct {
 			Hash    lipgloss.Style
 			Message lipgloss.Style
+			Who     lipgloss.Style
 		}
 	}
 
@@ -446,6 +447,9 @@ func DefaultStyles() *Styles {
 
 	s.Tree.Blame.Message = lipgloss.NewStyle()
 
+	s.Tree.Blame.Who = lipgloss.NewStyle().
+		Faint(true)
+
 	s.Spinner = lipgloss.NewStyle().
 		MarginTop(1).
 		MarginLeft(2).