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

[RFC PATCH 2/2] send-email: don't use Mail::Address, even if available

From
Matthieu Moy <git@matthieu-moy.fr>
Date
Aug 23, 2017, 10:21 UTC
Message-ID
<20170823102102.20120-2-git@matthieu-moy.fr>
In-Reply-To
<20170823102102.20120-1-git@matthieu-moy.fr>

Using Mail::Address made sense when we didn't have a proper parser. We now have a reasonable address parser, and using Mail::Address _if available_ causes much more trouble than it gives benefits:

* Developers typically test one version, not both.
* Users may not be aware that installing Mail::Address will change the
  behavior. They may complain about the behavior in one case without
  knowing that Mail::Address is involved.
* Having this optional Mail::Address makes it tempting to anwser "please
  install Mail::Address" to users instead of fixing our own code. We've
  reached the stage where bugs in our parser should be fixed, not worked
  around.
Signed-off-by: Matthieu Moy <git@matthieu-moy.fr>
---
 git-send-email.perl | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 33a69ffe5d..2208dcc213 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -155,7 +155,6 @@ sub format_2822_time {
 }
 
 my $have_email_valid = eval { require Email::Valid; 1 };
-my $have_mail_address = eval { require Mail::Address; 1 };
 my $smtp;
 my $auth;
 my $num_sent = 0;
@@ -490,11 +489,7 @@ my ($repoauthor, $repocommitter);
 ($repocommitter) = Git::ident_person(@repo, 'committer');
 
 sub parse_address_line {
-	if ($have_mail_address) {
-		return map { $_->format } Mail::Address->parse($_[0]);
-	} else {
-		return Git::parse_mailboxes($_[0]);
-	}
+	return Git::parse_mailboxes($_[0]);
 }
 
 sub split_addrs {
-- 
2.14.0.rc0.dirty
Previous: Matthieu MoyNext: Jacob Keller
Message 7 of 13 in “git send-email Cc with cruft not working as expected”
  1. Jacob KellerAug 22, 2017
  2. Stefan BellerAug 22, 2017
  3. Jacob KellerAug 22, 2017
  4. Stefan BellerAug 22, 2017
  5. Matthieu MoyAug 23, 2017
  6. 1/2 send-email: fix garbage removal after addressMatthieu Moy, Aug 23, 2017
  7. 2/2 send-email: don't use Mail::Address, even if availableMatthieu Moy, Aug 23, 2017
  8. Jacob KellerAug 23, 2017
  9. Junio C HamanoAug 24, 2017
  10. Matthieu MoyAug 25, 2017
  11. 1/2 send-email: fix garbage removal after addressMatthieu Moy, Aug 25, 2017
  12. 2/2 send-email: don't use Mail::Address, even if availableMatthieu Moy, Aug 25, 2017
  13. Jacob KellerAug 23, 2017

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.