git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
Date
Jun 9, 2015, 18:50 UTC
Message-ID
<1433875804-16007-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr>

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

The next commit will introduce a test for this aswell.
Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
 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
Next: Remi Lespinet
Message 1 of 11 in “send-email: suppress leading and trailing whitespaces in addresses”
  1. 6/7 send-email: suppress leading and trailing whitespaces in addressesRemi Lespinet, Jun 9, 2015
  2. 7/7 send-email: suppress leading and trailing whitespaces before alias expansionRemi Lespinet, Jun 9, 2015
  3. Matthieu MoyJun 10, 2015
  4. 7/7 send-email: suppress leading and trailing whitespaces before alias expansionRemi Lespinet, Jun 10, 2015
  5. Junio C HamanoJun 10, 2015
  6. Matthieu MoyJun 10, 2015
  7. 7/7 send-email: suppress leading and trailing whitespaces before alias expansionRemi Lespinet, Jun 10, 2015
  8. Junio C HamanoJun 10, 2015
  9. Matthieu MoyJun 10, 2015
  10. Matthieu MoyJun 10, 2015
  11. 6/7 send-email: suppress leading and trailing whitespaces in addressesRemi Lespinet, Jun 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.