From bd869f67b93b36e27405db5e288ee82f3a49051a Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Fri, 5 Jan 2018 19:36:51 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- perl/Git/Mail/Address.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 perl/Git/Mail/Address.pm (limited to 'perl/Git/Mail') diff --git a/perl/Git/Mail/Address.pm b/perl/Git/Mail/Address.pm new file mode 100755 index 0000000000..2ce3e84670 --- /dev/null +++ b/perl/Git/Mail/Address.pm @@ -0,0 +1,24 @@ +package Git::Mail::Address; +use 5.008; +use strict; +use warnings; + +=head1 NAME + +Git::Mail::Address - Wrapper for the L module, in case it's not installed + +=head1 DESCRIPTION + +This module is only intended to be used for code shipping in the +C repository. Use it for anything else at your peril! + +=cut + +eval { + require Mail::Address; + 1; +} or do { + require Git::FromCPAN::Mail::Address; +}; + +1; -- cgit v1.2.3