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:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							5f9953d2c3
						
					
				
				
					commit
					1ab2fd4f39
				
			@ -203,9 +203,9 @@ a password is obtained using 'git-credential'.
 | 
				
			|||||||
	specify a full pathname of a sendmail-like program instead;
 | 
						specify a full pathname of a sendmail-like program instead;
 | 
				
			||||||
	the program must support the `-i` option.  Default value can
 | 
						the program must support the `-i` option.  Default value can
 | 
				
			||||||
	be specified by the `sendemail.smtpServer` configuration
 | 
						be specified by the `sendemail.smtpServer` configuration
 | 
				
			||||||
	option; the built-in default is `/usr/sbin/sendmail` or
 | 
						option; the built-in default is to search for `sendmail` in
 | 
				
			||||||
	`/usr/lib/sendmail` if such program is available, or
 | 
						`/usr/sbin`, `/usr/lib` and $PATH if such program is
 | 
				
			||||||
	`localhost` otherwise.
 | 
						available, falling back to `localhost` otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
--smtp-server-port=<port>::
 | 
					--smtp-server-port=<port>::
 | 
				
			||||||
	Specifies a port different from the default port (SMTP
 | 
						Specifies a port different from the default port (SMTP
 | 
				
			||||||
 | 
				
			|||||||
@ -885,7 +885,9 @@ if (defined $initial_reply_to) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (!defined $smtp_server) {
 | 
					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 $_) {
 | 
							if (-x $_) {
 | 
				
			||||||
			$smtp_server = $_;
 | 
								$smtp_server = $_;
 | 
				
			||||||
			last;
 | 
								last;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user