[PATCH v3 6/7] send-email: suppress leading and trailing whitespaces in addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove leading and trailing whitespaces when sanitizing addresses so
that git send-email give the same output when passing arguments like
" jdoe@xxxxxxxxxxx   " or "\t jdoe@xxxxxxxxxxx " as with
"jdoe@xxxxxxxxxxx".

The next commit will introduce a test for this aswell.

Signed-off-by: Remi Lespinet <remi.lespinet@xxxxxxxxxxxxxxxxxxxxxxx>
---
 git-send-email.perl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index ea03308..3d144bd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -978,6 +978,9 @@ sub sanitize_address {
 	# remove garbage after email address
 	$recipient =~ s/(.*>).*$/$1/;
 
+	# remove leading and trailing whitespace
+	$recipient =~ s/^\s+|\s+$//g;
+
 	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);
 
 	if (not $recipient_name) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]