send-email: use built-in time() instead of /bin/date '+%s'
[git.git] / git-send-email.perl
index b0d095b..7c27eed 100755 (executable)
@@ -54,7 +54,7 @@ my $rc = GetOptions("from=s" => \$from,
                    "compose" => \$compose,
                    "quiet" => \$quiet,
                    "suppress-from" => \$suppress_from,
-                   "no-signed-off-cc" => \$no_signed_off_cc,
+                   "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
         );
 
 # Now, let's fill any that aren't set in with defaults:
@@ -258,8 +258,7 @@ my $message_id_template = "<%s-git-send-email-$message_id_from>";
 
 sub make_message_id
 {
-       my $date = `date "+\%s"`;
-       chomp($date);
+       my $date = time;
        my $pseudo_rand = int (rand(4200));
        $message_id = sprintf $message_id_template, "$date$pseudo_rand";
        #print "new message id = $message_id\n"; # Was useful for debugging
@@ -307,6 +306,7 @@ $subject = $initial_subject;
 foreach my $t (@files) {
        open(F,"<",$t) or die "can't open file $t";
 
+       my $author_not_sender = undef;
        @cc = @initial_cc;
        my $found_mbox = 0;
        my $header_done = 0;
@@ -321,7 +321,12 @@ foreach my $t (@files) {
                                        $subject = $1;
 
                                } elsif (/^(Cc|From):\s+(.*)$/) {
-                                       next if ($2 eq $from && $suppress_from);
+                                       if ($2 eq $from) {
+                                               next if ($suppress_from);
+                                       }
+                                       else {
+                                               $author_not_sender = $2;
+                                       }
                                        printf("(mbox) Adding cc: %s from line '%s'\n",
                                                $2, $_) unless $quiet;
                                        push @cc, $2;
@@ -360,6 +365,9 @@ foreach my $t (@files) {
                }
        }
        close F;
+       if (defined $author_not_sender) {
+               $message = "From: $author_not_sender\n\n$message";
+       }
 
        $cc = join(", ", unique_email_list(@cc));