summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorMatthieu Moy <git@matthieu-moy.fr>2018-01-05 19:36:51 +0100
committerJunio C Hamano <gitster@pobox.com>2018-01-05 12:21:31 -0800
commitbd869f67b93b36e27405db5e288ee82f3a49051a (patch)
tree769f097a317dd38285aadb7c9607f73f2440053f /git-send-email.perl
parent1eaabe34fc6f486367a176207420378f587d3b48 (diff)
downloadgit-bd869f67b93b36e27405db5e288ee82f3a49051a.tar.gz
send-email: add and use a local copy of Mail::Address
We used to have two versions of the email parsing code. Our parse_mailboxes (in Git.pm), and Mail::Address which we used if installed. Unfortunately, both versions have different sets of bugs, and changing the behavior of git depending on whether Mail::Address is installed was a bad idea. A first attempt to solve this was cc90750 (send-email: don't use Mail::Address, even if available, 2017-08-23), but it turns out our parse_mailboxes is too buggy for some uses. For example the lack of nested comments support breaks get_maintainer.pl in the Linux kernel tree: https://public-inbox.org/git/20171116154814.23785-1-alex.bennee@linaro.org/ This patch goes the other way: use Mail::Address anyway, but have a local copy from CPAN as a fallback, when the system one is not available. The duplicated script is small (276 lines of code) and stable in time. Maintaining the local copy should not be an issue, and will certainly be less burden than maintaining our own parse_mailboxes. Another option would be to consider Mail::Address as a hard dependency, but it's easy enough to save the trouble of extra-dependency to the end user or packager. Signed-off-by: Matthieu Moy <git@matthieu-moy.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index edcc6d3469..340b5c8482 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -30,6 +30,7 @@ use Error qw(:try);
use Cwd qw(abs_path cwd);
use Git;
use Git::I18N;
+use Git::Mail::Address;
Getopt::Long::Configure qw/ pass_through /;
@@ -489,7 +490,7 @@ my ($repoauthor, $repocommitter);
($repocommitter) = Git::ident_person(@repo, 'committer');
sub parse_address_line {
- return Git::parse_mailboxes($_[0]);
+ return map { $_->format } Mail::Address->parse($_[0]);
}
sub split_addrs {