Subject: [PATCH] git-send-email: use ! to indicate relative path to command

From: Gregory Anders <[email-masked]>
Date: Tue, 11 May 2021 12:37:03 -0600

When the smtpServer config option is prefixed with a ! character, the
value of the option should be interpreted as a command to look up on
PATH.
---

Please note that I am a total perl newbie. It's very likely that I did 
something suboptimally or in a non-idiomatic way. Please let me know if 
that's the case.

 git-send-email.perl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 175da07d94..dbc5a2f51c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1492,7 +1492,11 @@ sub send_message {
 
 	if ($dry_run) {
 		# We don't want to send the email.
-	} elsif (file_name_is_absolute($smtp_server)) {
+	} elsif (file_name_is_absolute($smtp_server) || $smtp_server =~ /^!/) {
+		if ($smtp_server =~ s/^!//) {
+			my $smtp_server = map {"$_/$smtp_server"} split /:/, $ENV{PATH};
+		}
+
 		my $pid = open my $sm, '|-';
 		defined $pid or die $!;
 		if (!$pid) {
-- 
2.31.1.576.gc7e8ed1dea