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

[PATCH 1/3] gitweb: Add author and committer email extraction to parse_commit

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 25, 2006, 14:54 UTC
Message-ID
<11644664852840-git-send-email-jnareb@gmail.com>
In-Reply-To
<11644664743455-git-send-email-jnareb@gmail.com>

Extract author email to 'author_email' key, and comitter mail to 'committer_mail' key; uniquify committer and author lines handling by the way.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1cded75..2ebd9d7 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1294,8 +1294,9 @@ sub parse_commit {
 			$co{'author'} = $1;
 			$co{'author_epoch'} = $2;
 			$co{'author_tz'} = $3;
-			if ($co{'author'} =~ m/^([^<]+) </) {
-				$co{'author_name'} = $1;
+			if ($co{'author'} =~ m/^([^<]+) <([^>]*)>/) {
+				$co{'author_name'}  = $1;
+				$co{'author_email'} = $2;
 			} else {
 				$co{'author_name'} = $co{'author'};
 			}
@@ -1304,7 +1305,12 @@ sub parse_commit {
 			$co{'committer_epoch'} = $2;
 			$co{'committer_tz'} = $3;
 			$co{'committer_name'} = $co{'committer'};
-			$co{'committer_name'} =~ s/ <.*//;
+			if ($co{'committer'} =~ m/^([^<]+) <([^>]*)>/) {
+				$co{'committer_name'}  = $1;
+				$co{'committer_email'} = $2;
+			} else {
+				$co{'committer_name'} = $co{'committer'};
+			}
 		}
 	}
 	if (!defined $co{'tree'}) {
-- 
1.4.4.1
Next: Jakub Narebski
Message 1 of 3 in “gitweb: Add author and committer email extraction to parse_commit”
  1. 1/3 gitweb: Add author and committer email extraction to parse_commitJakub Narebski, Nov 25, 2006
  2. 2/3 gitweb: Add author and contributor email to Atom feedJakub Narebski, Nov 25, 2006
  3. 3/3 gitweb: Use author_epoch for pubdate in gitweb feedsJakub Narebski, Nov 25, 2006

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.