git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] gitweb: Add author and committer email extraction to parse_commit
       [not found] <11644664743455-git-send-email-jnareb@gmail.com>
@ 2006-11-25 14:54 ` Jakub Narebski
  2006-11-25 14:54 ` [PATCH 2/3] gitweb: Add author and contributor email to Atom feed Jakub Narebski
  2006-11-25 14:54 ` [PATCH 3/3] gitweb: Use author_epoch for pubdate in gitweb feeds Jakub Narebski
  2 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-11-25 14:54 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] gitweb: Add author and contributor email to Atom feed
       [not found] <11644664743455-git-send-email-jnareb@gmail.com>
  2006-11-25 14:54 ` [PATCH 1/3] gitweb: Add author and committer email extraction to parse_commit Jakub Narebski
@ 2006-11-25 14:54 ` Jakub Narebski
  2006-11-25 14:54 ` [PATCH 3/3] gitweb: Use author_epoch for pubdate in gitweb feeds Jakub Narebski
  2 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-11-25 14:54 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

Add author email (from 'author_email') and contributor email (from
'committer_email') to items in the Atom format gitweb feed.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 2ebd9d7..15dd1f4 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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" .
-- 
1.4.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] gitweb: Use author_epoch for pubdate in gitweb feeds
       [not found] <11644664743455-git-send-email-jnareb@gmail.com>
  2006-11-25 14:54 ` [PATCH 1/3] gitweb: Add author and committer email extraction to parse_commit Jakub Narebski
  2006-11-25 14:54 ` [PATCH 2/3] gitweb: Add author and contributor email to Atom feed Jakub Narebski
@ 2006-11-25 14:54 ` Jakub Narebski
  2 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-11-25 14:54 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

Use creation date (author_epoch) instead of former commit date
(committer_epoch) as publish date in gitweb feeds (RSS, Atom).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
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(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 15dd1f4..fac7923 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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,
-- 
1.4.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-25 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <11644664743455-git-send-email-jnareb@gmail.com>
2006-11-25 14:54 ` [PATCH 1/3] gitweb: Add author and committer email extraction to parse_commit Jakub Narebski
2006-11-25 14:54 ` [PATCH 2/3] gitweb: Add author and contributor email to Atom feed Jakub Narebski
2006-11-25 14:54 ` [PATCH 3/3] gitweb: Use author_epoch for pubdate in gitweb feeds Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).