git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Gregory Anders <greg@gpanders.com>
To: git@vger.kernel.org
Cc: Gregory Anders <greg@gpanders.com>
Subject: [PATCH] git-send-email: use ! to indicate relative path to command
Date: Tue, 11 May 2021 12:37:03 -0600	[thread overview]
Message-ID: <20210511183703.9488-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.
---

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


             reply	other threads:[~2021-05-11 18:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 18:37 Gregory Anders [this message]
2021-05-11 18:57 ` [PATCH] git-send-email: use ! to indicate relative path to command Jeff King
2021-05-11 19:03   ` Gregory Anders
2021-05-11 19:11     ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210511183703.9488-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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).