gitweb: Add author and contributor email to Atom feed
PATCH 2/3 gitweb: Add author and contributor email to Atom feed
In reply to a message not in the archiveAdd author email (from 'author_email') and contributor email (from 'committer_email') to items in the Atom format gitweb feed.
Signed-off-by Jakub Narebski <[email protected]>
--- gitweb/gitweb.perl | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +12 -2
@@ -4323,9 +4323,19 @@ XML print "<entry>\n" . "<title type=\"html\">" . esc_html($co{'title'}) . "</title>\n" . "<updated>$cd{'iso-8601'}</updated>\n" . - "<author><name>" . esc_html($co{'author_name'}) . "</name></author>\n" . + "<author>\n" . + " <name>" . esc_html($co{'author_name'}) . "</name>\n"; + if ($co{'author_email'}) { + print " <email>" . esc_html($co{'author_email'}) . "</email>\n"; + } + print "</author>\n" . # use committer for contributor - "<contributor><name>" . esc_html($co{'committer_name'}) . "</name></contributor>\n" . + "<contributor>\n" . + " <name>" . esc_html($co{'committer_name'}) . "</name>\n"; + if ($co{'committer_email'}) { + print " <email>" . esc_html($co{'committer_email'}) . "</email>\n"; + } + print "</contributor>\n" . "<published>$cd{'iso-8601'}</published>\n" . "<link rel=\"alternate\" type=\"text/html\" href=\"$co_url\" />\n" . "<id>$co_url</id>\n" .
Signature · 1 line
1.4.4.1
PATCH 3/3 gitweb: Use author_epoch for pubdate in gitweb feeds
In reply to a message not in the archiveUse creation date (author_epoch) instead of former commit date (committer_epoch) as publish date in gitweb feeds (RSS, Atom).
Signed-off-by Jakub Narebski <[email protected]>
---
This I'm not so sure about. I just wonder why commit date was used as publish date of feed item/entry...
gitweb/gitweb.perl | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
gitweb/gitweb.perl +3 -3
@@ -4201,7 +4201,7 @@ sub git_feed { } if (defined($revlist[0])) { %latest_commit = parse_commit($revlist[0]); - %latest_date = parse_date($latest_commit{'committer_epoch'}); + %latest_date = parse_date($latest_commit{'author_epoch'}); print $cgi->header( -type => $content_type, -charset => 'utf-8',
@@ -4294,10 +4294,10 @@ XML my $commit = $revlist[$i]; my %co = parse_commit($commit); # we read 150, we always show 30 and the ones more recent than 48 hours - if (($i >= 20) && ((time - $co{'committer_epoch'}) > 48*60*60)) { + if (($i >= 20) && ((time - $co{'author_epoch'}) > 48*60*60)) { last; } - my %cd = parse_date($co{'committer_epoch'}); + my %cd = parse_date($co{'author_epoch'}); # get list of changed files open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
Signature · 1 line
1.4.4.1
PATCH 1/3 gitweb: Add author and committer email extraction to parse_commit
In reply to a message not in the archiveExtract 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 <[email protected]>
--- gitweb/gitweb.perl | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
gitweb/gitweb.perl +9 -3
@@ -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'}) {
Signature · 1 line
1.4.4.1