devel/review: fix addition of reviewer from environment
authorKlaus Aehlig <aehlig@google.com>
Mon, 22 Apr 2013 09:08:29 +0000 (11:08 +0200)
committerKlaus Aehlig <aehlig@google.com>
Mon, 22 Apr 2013 09:48:43 +0000 (11:48 +0200)
In commit 3dd990, the possibility of taking a default reviewer
from the environment was introduced. Fix two deficits here
- perl does not inherit the environment
- add at all places.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

devel/review

index e2ddd62..d3f6594 100755 (executable)
@@ -38,13 +38,15 @@ add_reviewed_by() {
   grep -q '^Reviewed-by: ' "$msgfile" && return
 
   perl -i -e '
+  my $reviewer = $ENV{"REVIEWER"};
+  defined($reviewer) or $reviewer = "";
   my $sob = 0;
   while (<>) {
     if ($sob == 0 and m/^Signed-off-by:/) {
       $sob = 1;
 
     } elsif ($sob == 1 and not m/^Signed-off-by:/) {
-      print "Reviewed-by: $REVIEWER\n";
+      print "Reviewed-by: $reviewer\n";
       $sob = -1;
     }
 
@@ -52,7 +54,7 @@ add_reviewed_by() {
   }
 
   if ($sob == 1) {
-    print "Reviewed-by: \n";
+    print "Reviewed-by: $reviewer\n";
   }
   ' "$msgfile"
 }