{"thread":{"id":"43518","subject":"[PATCH 2/3] gitweb: Add author and contributor email to Atom feed","startedAt":"2006-11-25T14:54:32Z","lastAt":"2006-11-25T14:54:34Z","messageCount":3,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"298375","messageId":"11644664852840-git-send-email-jnareb@gmail.com","threadId":"43518","inReplyTo":"11644664743455-git-send-email-jnareb@gmail.com","subject":"[PATCH 1/3] gitweb: Add author and committer email extraction to parse_commit","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-25T14:54:32Z","receivedAt":"2006-11-25T14:54:32Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Extract author email to 'author_email' key, and comitter mail to\n'committer_mail' key; uniquify committer and author lines handling\nby the way.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   12 +++++++++---\n 1 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 1cded75..2ebd9d7 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1294,8 +1294,9 @@ sub parse_commit {\n \t\t\t$co{'author'} = $1;\n \t\t\t$co{'author_epoch'} = $2;\n \t\t\t$co{'author_tz'} = $3;\n-\t\t\tif ($co{'author'} =~ m/^([^<]+) </) {\n-\t\t\t\t$co{'author_name'} = $1;\n+\t\t\tif ($co{'author'} =~ m/^([^<]+) <([^>]*)>/) {\n+\t\t\t\t$co{'author_name'}  = $1;\n+\t\t\t\t$co{'author_email'} = $2;\n \t\t\t} else {\n \t\t\t\t$co{'author_name'} = $co{'author'};\n \t\t\t}\n@@ -1304,7 +1305,12 @@ sub parse_commit {\n \t\t\t$co{'committer_epoch'} = $2;\n \t\t\t$co{'committer_tz'} = $3;\n \t\t\t$co{'committer_name'} = $co{'committer'};\n-\t\t\t$co{'committer_name'} =~ s/ <.*//;\n+\t\t\tif ($co{'committer'} =~ m/^([^<]+) <([^>]*)>/) {\n+\t\t\t\t$co{'committer_name'}  = $1;\n+\t\t\t\t$co{'committer_email'} = $2;\n+\t\t\t} else {\n+\t\t\t\t$co{'committer_name'} = $co{'committer'};\n+\t\t\t}\n \t\t}\n \t}\n \tif (!defined $co{'tree'}) {\n-- \n1.4.4.1\n"},{"id":"295243","messageId":"11644665113030-git-send-email-jnareb@gmail.com","threadId":"43518","inReplyTo":"11644664743455-git-send-email-jnareb@gmail.com","subject":"[PATCH 2/3] gitweb: Add author and contributor email to Atom feed","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-25T14:54:33Z","receivedAt":"2006-11-25T14:54:33Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Add author email (from 'author_email') and contributor email (from\n'committer_email') to items in the Atom format gitweb feed.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   14 ++++++++++++--\n 1 files changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 2ebd9d7..15dd1f4 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4323,9 +4323,19 @@ XML\n \t\t\tprint \"<entry>\\n\" .\n \t\t\t      \"<title type=\\\"html\\\">\" . esc_html($co{'title'}) . \"</title>\\n\" .\n \t\t\t      \"<updated>$cd{'iso-8601'}</updated>\\n\" .\n-\t\t\t      \"<author><name>\" . esc_html($co{'author_name'}) . \"</name></author>\\n\" .\n+\t\t\t      \"<author>\\n\" .\n+\t\t\t      \"  <name>\" . esc_html($co{'author_name'}) . \"</name>\\n\";\n+\t\t\tif ($co{'author_email'}) {\n+\t\t\t\tprint \"  <email>\" . esc_html($co{'author_email'}) . \"</email>\\n\";\n+\t\t\t}\n+\t\t\tprint \"</author>\\n\" .\n \t\t\t      # use committer for contributor\n-\t\t\t      \"<contributor><name>\" . esc_html($co{'committer_name'}) . \"</name></contributor>\\n\" .\n+\t\t\t      \"<contributor>\\n\" .\n+\t\t\t      \"  <name>\" . esc_html($co{'committer_name'}) . \"</name>\\n\";\n+\t\t\tif ($co{'committer_email'}) {\n+\t\t\t\tprint \"  <email>\" . esc_html($co{'committer_email'}) . \"</email>\\n\";\n+\t\t\t}\n+\t\t\tprint \"</contributor>\\n\" .\n \t\t\t      \"<published>$cd{'iso-8601'}</published>\\n\" .\n \t\t\t      \"<link rel=\\\"alternate\\\" type=\\\"text/html\\\" href=\\\"$co_url\\\" />\\n\" .\n \t\t\t      \"<id>$co_url</id>\\n\" .\n-- \n1.4.4.1\n"},{"id":"295654","messageId":"11644665273247-git-send-email-jnareb@gmail.com","threadId":"43518","inReplyTo":"11644664743455-git-send-email-jnareb@gmail.com","subject":"[PATCH 3/3] gitweb: Use author_epoch for pubdate in gitweb feeds","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-25T14:54:34Z","receivedAt":"2006-11-25T14:54:34Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Use creation date (author_epoch) instead of former commit date\n(committer_epoch) as publish date in gitweb feeds (RSS, Atom).\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis I'm not so sure about. I just wonder why commit date was used\nas publish date of feed item/entry...\n\n gitweb/gitweb.perl |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 15dd1f4..fac7923 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4201,7 +4201,7 @@ sub git_feed {\n \t}\n \tif (defined($revlist[0])) {\n \t\t%latest_commit = parse_commit($revlist[0]);\n-\t\t%latest_date   = parse_date($latest_commit{'committer_epoch'});\n+\t\t%latest_date   = parse_date($latest_commit{'author_epoch'});\n \t\tprint $cgi->header(\n \t\t\t-type => $content_type,\n \t\t\t-charset => 'utf-8',\n@@ -4294,10 +4294,10 @@ XML\n \t\tmy $commit = $revlist[$i];\n \t\tmy %co = parse_commit($commit);\n \t\t# we read 150, we always show 30 and the ones more recent than 48 hours\n-\t\tif (($i >= 20) && ((time - $co{'committer_epoch'}) > 48*60*60)) {\n+\t\tif (($i >= 20) && ((time - $co{'author_epoch'}) > 48*60*60)) {\n \t\t\tlast;\n \t\t}\n-\t\tmy %cd = parse_date($co{'committer_epoch'});\n+\t\tmy %cd = parse_date($co{'author_epoch'});\n \n \t\t# get list of changed files\n \t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n-- \n1.4.4.1\n"}]}