gitweb: Add author and committer email extraction to parse_commit
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Nov 25, 2006 at 15:54 UTC
ba00b8c1edafcc414cfe13f8a4addac3893c2a29
1 file changed
+9
-3
gitweb/gitweb.perl
+9
-3
@@ -1294,8 +1294,9 @@ sub parse_commit {
1294
$co{'author'} = $1;
1295
$co{'author_epoch'} = $2;
1296
$co{'author_tz'} = $3;
1297
- if ($co{'author'} =~ m/^([^<]+) </) {
1298
- $co{'author_name'} = $1;
1297
+ if ($co{'author'} =~ m/^([^<]+) <([^>]*)>/) {
1298
+ $co{'author_name'} = $1;
1299
+ $co{'author_email'} = $2;
1300
} else {
1301
$co{'author_name'} = $co{'author'};
1302
}
@@ -1304,7 +1305,12 @@ sub parse_commit {
1305
$co{'committer_epoch'} = $2;
1306
$co{'committer_tz'} = $3;
1307
$co{'committer_name'} = $co{'committer'};
1307
- $co{'committer_name'} =~ s/ <.*//;
1308
+ if ($co{'committer'} =~ m/^([^<]+) <([^>]*)>/) {
1309
+ $co{'committer_name'} = $1;
1310
+ $co{'committer_email'} = $2;
1311
+ } else {
1312
+ $co{'committer_name'} = $co{'committer'};
1313
+ }
1314
}
1315
}
1316
if (!defined $co{'tree'}) {