git-send-email: honor $PATH for sendmail binary

This extends git-send-email to also consider sendmail binaries in $PATH
after checking the (fixed) list of /usr/sbin and /usr/lib, and before
falling back to localhost.

Signed-off-by: Florian Klink <flokli@flokli.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Florian Klink
2017-11-28 01:49:04 +01:00
committed by Junio C Hamano
parent 5f9953d2c3
commit 1ab2fd4f39
2 changed files with 6 additions and 4 deletions

View File

@ -885,7 +885,9 @@ if (defined $initial_reply_to) {
}
if (!defined $smtp_server) {
foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
my @sendmail_paths = qw( /usr/sbin/sendmail /usr/lib/sendmail );
push @sendmail_paths, map {"$_/sendmail"} split /:/, $ENV{PATH};
foreach (@sendmail_paths) {
if (-x $_) {
$smtp_server = $_;
last;