git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] gitweb: Add author initials in 'blame' view, a la "git gui blame"

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 10, 2009, 22:01 UTC
Message-ID
<200907110001.24093.jnareb@gmail.com>
In-Reply-To
<200907102354.43232.jnareb@gmail.com>

For example for "Junio C Hamano" initials would be "JH". Of course initials are added (below shortened SHA-1 of blamed commit) only if group of lines has 2 lines or more in it.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Let the bikeshedding begin!

Should it be "JH" or perhaps "J.H." for "Junio C Hamano"? Or perhaps username part of author email would be better solution than initials? Should we use different style for those initials?

This patch was inspired by me adding the same feature in similar 
'blame_incremental' view in
  http://thread.gmane.org/gmane.comp.version-control.git/102657/focus=102712
 gitweb/gitweb.perl |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 36b1ce5..5336c92 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4860,6 +4860,14 @@ HTML
 			                             hash=>$full_rev,
 			                             file_name=>$file_name)},
 			              esc_html($short_rev));
+			if ($group_size >= 2) {
+				my @author_initials = ($author =~ /\b([[:upper:]])\B/g);
+				if (@author_initials) {
+					print "<br />" .
+					      esc_html(join('', @author_initials));
+					#           or join('.', ...)
+				}
+			}
 			print "</td>\n";
 		}
 		# 'previous' <sha1 of parent commit> <filename at commit>
-- 
1.6.3.3
Previous: Jakub NarebskiNext: Jakub Narebski
Message 8 of 11 in “gitweb: 'blame' view improvements”
  1. 0/3 gitweb: 'blame' view improvementsJakub Narebski, Jul 10, 2009
  2. 1/3 gitweb: Mark boundary commits in 'blame' viewJakub Narebski, Jul 10, 2009
  3. 2/3 gitweb: Use "previous" header of git-blame -p in 'blame' viewJakub Narebski, Jul 10, 2009
  4. Junio C HamanoJul 10, 2009
  5. Jakub NarebskiJul 11, 2009
  6. Luben TuikovJul 12, 2009
  7. Jakub NarebskiJul 14, 2009
  8. 3/3 gitweb: Add author initials in 'blame' view, a la "git gui blame"Jakub Narebski, Jul 10, 2009
  9. Jakub NarebskiJul 11, 2009
  10. 5/3 gitweb: Incremental blame (proof of concept)Jakub Narebski, Jul 13, 2009
  11. 4/3 gitweb: Use light/dark class also in 'blame' viewJakub Narebski, Jul 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.