···1-From 9a4396ddaedaf59ebee16d69900884e990b79cdd Mon Sep 17 00:00:00 2001
2-From: Florian Klink <flokli@flokli.de>
3-Date: Fri, 17 Nov 2017 13:21:37 +0100
4-Subject: [PATCH] git-send-email: honor $PATH
5-6-This will search $PATH for a sendmail binary, instead of the (previously
7-fixed) list of paths.
8-9-Signed-off-by: Florian Klink <flokli@flokli.de>
10----
11- Documentation/git-send-email.txt | 5 ++---
12- git-send-email.perl | 3 ++-
13- 2 files changed, 4 insertions(+), 4 deletions(-)
14-15diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
16-index bac9014ac..b9b1f2c41 100644
17--- a/Documentation/git-send-email.txt
18+++ b/Documentation/git-send-email.txt
19-@@ -203,9 +203,8 @@ a password is obtained using 'git-credential'.
20 specify a full pathname of a sendmail-like program instead;
21 the program must support the `-i` option. Default value can
22 be specified by the `sendemail.smtpServer` configuration
23-- option; the built-in default is `/usr/sbin/sendmail` or
24-- `/usr/lib/sendmail` if such program is available, or
25-- `localhost` otherwise.
26-+ option; the built-in default is to search in $PATH if such program is
27-+ available, or `localhost` otherwise.
28-29 --smtp-server-port=<port>::
30- Specifies a port different from the default port (SMTP
31diff --git a/git-send-email.perl b/git-send-email.perl
32-index 2208dcc21..8e357aeab 100755
33--- a/git-send-email.perl
34+++ b/git-send-email.perl
35-@@ -885,7 +885,8 @@ if (defined $initial_reply_to) {
36 }
37-38 if (!defined $smtp_server) {
39-- foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
040+ my @sendmail_paths = map {"$_/sendmail"} split /:/, $ENV{PATH};
41-+ foreach (@sendmail_paths) {
42 if (-x $_) {
43 $smtp_server = $_;
44- last;
45---
46-2.15.0
47-
···000000000000001diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
2+index 8060ea35c..c81067a19 100644
3--- a/Documentation/git-send-email.txt
4+++ b/Documentation/git-send-email.txt
5+@@ -203,8 +203,7 @@ a password is obtained using 'git-credential'.
6 specify a full pathname of a sendmail-like program instead;
7 the program must support the `-i` option. Default value can
8 be specified by the `sendemail.smtpServer` configuration
9+- option; the built-in default is to search for `sendmail` in
10+- `/usr/sbin`, `/usr/lib` and $PATH if such program is
11++ option; the built-in default is to search in $PATH if such program is
12+ available, falling back to `localhost` otherwise.
13+014 --smtp-server-port=<port>::
015diff --git a/git-send-email.perl b/git-send-email.perl
16+index edcc6d346..8e357aeab 100755
17--- a/git-send-email.perl
18+++ b/git-send-email.perl
19+@@ -885,8 +885,7 @@ if (defined $initial_reply_to) {
20 }
21+22 if (!defined $smtp_server) {
23+- my @sendmail_paths = qw( /usr/sbin/sendmail /usr/lib/sendmail );
24+- push @sendmail_paths, map {"$_/sendmail"} split /:/, $ENV{PATH};
25+ my @sendmail_paths = map {"$_/sendmail"} split /:/, $ENV{PATH};
26+ foreach (@sendmail_paths) {
27 if (-x $_) {
28 $smtp_server = $_;
0000