]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Add author and committer email extraction to parse_commit
authorJakub Narebski <redacted>
Sat, 25 Nov 2006 14:54:32 +0000 (15:54 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 0fac8e25f2d91302e77b173ce4ad1cf9d22c74de3ff475e70731df5b8089ff9c..6e727c8b914956005da4a0522f56d49c3bafc952c5633fa2b8f46ab248e2635b 100755 (executable)
@@ -1295,8 +1295,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'};
                        }
@@ -1305,7 +1306,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'}) {
This page took 0.305639 seconds and 4 git commands to generate.