[or-cvs] [githax/master] Revise email script to handle dates better.

Nick Mathewson nickm at seul.org
Tue Apr 21 20:52:43 UTC 2009


Author: Nick Mathewson <nickm at torproject.org>
Subject: Revise email script to handle dates better.

Previously, we stuck the date from the patch into the email headers.
Now we stick that in the email body, and stick the _merge_ date into
the header.  This way emails show up in the order that stuff is merged
into the repo, rather than in the order that the patches were
originally written.
---
 hooks/copyheaders.pl    |    4 +++-
 hooks/post-receive-diff |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hooks/copyheaders.pl b/hooks/copyheaders.pl
index a4485ab..ce14a47 100755
--- a/hooks/copyheaders.pl
+++ b/hooks/copyheaders.pl
@@ -2,13 +2,15 @@
 
 $from = "";
 $subject = "";
+$date = "";
 
 while(<>) {
   print;
   chomp;
   if (/^From: (.*)/) { $from = $1; }
   if (/^Subject: \[[^\]]*\] *(.*)/) { $subject = $1; }
-  if (/^$/) { print "Author: $from\nSubject: $subject\n\n"; last; }
+  if (/^Date: (.*)/) { $date = $1; }
+  if (/^$/) { print "Author: $from\nDate: $date\nSubject: $subject\n\n"; last; }
 }
 
 while(<>)  { print; }
diff --git a/hooks/post-receive-diff b/hooks/post-receive-diff
index 1b8c106..548b22d 100755
--- a/hooks/post-receive-diff
+++ b/hooks/post-receive-diff
@@ -48,5 +48,5 @@ while read oldrev newrev refname; do
 
     git-format-patch --subject-prefix="$projectname/${refname#refs/heads/}" \
 		     --stdout "$oldrev..$newrev" |
-		     formail -s /home/or/git-helpers/copyheaders.pl | formail -I "To: $recipients" -R From: Patch-Author: -I "From " -s /usr/sbin/sendmail -t
+		     formail -s /home/or/git-helpers/copyheaders.pl | formail -I "To: $recipients" -R From: Patch-Author: -I "From " -I Date: -s /usr/sbin/sendmail -t
 done
-- 
1.5.6.5



More information about the tor-commits mailing list