···11-From 9a4396ddaedaf59ebee16d69900884e990b79cdd Mon Sep 17 00:00:00 2001
22-From: Florian Klink <flokli@flokli.de>
33-Date: Fri, 17 Nov 2017 13:21:37 +0100
44-Subject: [PATCH] git-send-email: honor $PATH
55-66-This will search $PATH for a sendmail binary, instead of the (previously
77-fixed) list of paths.
88-99-Signed-off-by: Florian Klink <flokli@flokli.de>
1010----
1111- Documentation/git-send-email.txt | 5 ++---
1212- git-send-email.perl | 3 ++-
1313- 2 files changed, 4 insertions(+), 4 deletions(-)
1414-151diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
1616-index bac9014ac..b9b1f2c41 100644
22+index 8060ea35c..c81067a19 100644
173--- a/Documentation/git-send-email.txt
184+++ b/Documentation/git-send-email.txt
1919-@@ -203,9 +203,8 @@ a password is obtained using 'git-credential'.
55+@@ -203,8 +203,7 @@ a password is obtained using 'git-credential'.
206 specify a full pathname of a sendmail-like program instead;
217 the program must support the `-i` option. Default value can
228 be specified by the `sendemail.smtpServer` configuration
2323-- option; the built-in default is `/usr/sbin/sendmail` or
2424-- `/usr/lib/sendmail` if such program is available, or
2525-- `localhost` otherwise.
2626-+ option; the built-in default is to search in $PATH if such program is
2727-+ available, or `localhost` otherwise.
2828-99+- option; the built-in default is to search for `sendmail` in
1010+- `/usr/sbin`, `/usr/lib` and $PATH if such program is
1111++ option; the built-in default is to search in $PATH if such program is
1212+ available, falling back to `localhost` otherwise.
1313+2914 --smtp-server-port=<port>::
3030- Specifies a port different from the default port (SMTP
3115diff --git a/git-send-email.perl b/git-send-email.perl
3232-index 2208dcc21..8e357aeab 100755
1616+index edcc6d346..8e357aeab 100755
3317--- a/git-send-email.perl
3418+++ b/git-send-email.perl
3535-@@ -885,7 +885,8 @@ if (defined $initial_reply_to) {
1919+@@ -885,8 +885,7 @@ if (defined $initial_reply_to) {
3620 }
3737-2121+3822 if (!defined $smtp_server) {
3939-- foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
2323+- my @sendmail_paths = qw( /usr/sbin/sendmail /usr/lib/sendmail );
2424+- push @sendmail_paths, map {"$_/sendmail"} split /:/, $ENV{PATH};
4025+ my @sendmail_paths = map {"$_/sendmail"} split /:/, $ENV{PATH};
4141-+ foreach (@sendmail_paths) {
2626+ foreach (@sendmail_paths) {
4227 if (-x $_) {
4328 $smtp_server = $_;
4444- last;
4545---
4646-2.15.0
4747-