Fix a bug in email extraction used in git-send-email.
[gitweb.git] / git-send-email.perl
index 85ec5df13ab1cb5868ab781e8b68d283f006e020..d418d6c5d2230fde2e201d31ff82dc5e26e79a9a 100755 (executable)
@@ -322,7 +322,11 @@ sub extract_valid_address {
        } else {
                # less robust/correct than the monster regexp in Email::Valid,
                # but still does a 99% job, and one less dependency
-               return ($address =~ /([^\"<>\s]+@[^<>\s]+)/);
+               my $cleaned_address;
+               if ($address =~ /([^\"<>\s]+@[^<>\s]+)/) {
+                       $cleaned_address = $1;
+               }
+               return $cleaned_address;
        }
 }
 
@@ -416,6 +420,7 @@ sub send_message
 }
 
 $reply_to = $initial_reply_to;
+$references = $initial_reply_to;
 make_message_id();
 $subject = $initial_subject;