summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorRemi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>2015-06-30 14:16:45 +0200
committerJunio C Hamano <gitster@pobox.com>2015-06-30 11:34:35 -0700
commitb5e112d8d240b299553f17c8e476ef16fca4001f (patch)
tree72a2183cd1be52acb75a2933505a455180e07587 /git-send-email.perl
parentd4cf11c2e948890c2daf27fba6727e3b814cfe3c (diff)
downloadgit-b5e112d8d240b299553f17c8e476ef16fca4001f.tar.gz
send-email: refactor address list process
Simplify code by creating a function which transform a list of strings containing email addresses (separated by commas, comporting aliases) into a clean list of valid email addresses. Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl22
1 files changed, 12 insertions, 10 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 0cac4b0077..05af83993b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -808,12 +808,9 @@ sub expand_one_alias {
return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;
}
-@initial_to = expand_aliases(@initial_to);
-@initial_to = validate_address_list(sanitize_address_list(@initial_to));
-@initial_cc = expand_aliases(@initial_cc);
-@initial_cc = validate_address_list(sanitize_address_list(@initial_cc));
-@bcclist = expand_aliases(@bcclist);
-@bcclist = validate_address_list(sanitize_address_list(@bcclist));
+@initial_to = process_address_list(@initial_to);
+@initial_cc = process_address_list(@initial_cc);
+@bcclist = process_address_list(@bcclist);
if ($thread && !defined $initial_reply_to && $prompting) {
$initial_reply_to = ask(
@@ -1026,6 +1023,13 @@ sub sanitize_address_list {
return (map { sanitize_address($_) } @_);
}
+sub process_address_list {
+ my @addr_list = expand_aliases(@_);
+ @addr_list = sanitize_address_list(@addr_list);
+ @addr_list = validate_address_list(@addr_list);
+ return @addr_list;
+}
+
# Returns the local Fully Qualified Domain Name (FQDN) if available.
#
# Tightly configured MTAa require that a caller sends a real DNS
@@ -1535,10 +1539,8 @@ foreach my $t (@files) {
($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
$needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc);
- @to = expand_aliases(@to);
- @to = validate_address_list(sanitize_address_list(@to));
- @cc = expand_aliases(@cc);
- @cc = validate_address_list(sanitize_address_list(@cc));
+ @to = process_address_list(@to);
+ @cc = process_address_list(@cc);
@to = (@initial_to, @to);
@cc = (@initial_cc, @cc);