From: Gregory Anders <greg@gpanders.com>
To: git@vger.kernel.org
Cc: Gregory Anders <greg@gpanders.com>
Subject: [PATCH v2] git-send-email: use ! to indicate relative path to command
Date: Tue, 11 May 2021 13:01:01 -0600 [thread overview]
Message-ID: <20210511190101.22128-1-greg@gpanders.com> (raw)
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.
---
Fix the implementation to correctly find the absolute path for the given
command, and report an error if the command is not found on PATH.
git-send-email.perl | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 175da07d94..6d10901595 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1492,7 +1492,24 @@ 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_command;
+ my @progs = map {"$_/$smtp_server"} split /:/, $ENV{PATH};
+ foreach (@progs) {
+ if (-x $_) {
+ $smtp_command = $_;
+ last;
+ }
+ }
+
+ if (!defined $smtp_command) {
+ die __("The command $smtp_server was not found on PATH.")
+ }
+
+ $smtp_server = $smtp_command;
+ }
+
my $pid = open my $sm, '|-';
defined $pid or die $!;
if (!$pid) {
--
2.31.1.576.g55f6e1c2f1
reply other threads:[~2021-05-11 19:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210511190101.22128-1-greg@gpanders.com \
--to=greg@gpanders.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.