git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Gregory Anders <greg@gpanders.com>
Date
May 11, 2021, 18:37 UTC
Message-ID
<20210511183703.9488-1-greg@gpanders.com>

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
Next: Jeff King
Message 1 of 4 in “git-send-email: use ! to indicate relative path to command”
  1. git-send-email: use ! to indicate relative path to commandGregory Anders, May 11, 2021
  2. Jeff KingMay 11, 2021
  3. Gregory AndersMay 11, 2021
  4. Jeff KingMay 11, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.