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

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 11, 2021, 23:09 UTC
Message-ID
<xmqqk0o4j2ax.fsf@gitster.g>
In-Reply-To
<20210511204044.69047-1-greg@gpanders.com>
Gregory Anders <greg@gpanders.com> writes:
> Presently, the smtpServer config option can use a sendmail-like program

s/Presently, t/T/; Also if I understand it correctly this is not just about configuration varible but equally applies to the command line option --smtp-server, so mention both of them in their full name, i.e.

    The sendemail.smtpServer configuration variable and the
    "--smtp-server" command line option can name a program to use by
    providing ...
Show 14 quoted lines
> by providing an absolute path to the program as the value for this
> option. However, an absolute path is not always portable and it is often
> preferable to simply specify a program name and have `git-send-email`
> find that program on $PATH.
>
> For example, if a user wishes to use msmtp to send emails, they might
> be able to simply use
>
>     [sendemail]
>             smtpServer = !msmtp
>
> instead of using the full path. This is particularly useful when a
> common git config file is used across multiple systems where the
> absolute path to a given program may differ.
Nicely explained.
> To that end, this patch allows the smtpServer config option to be
> prefixed with a ! character that implements the above behavior; namely,
> the specified value (sans the ! character) is used as if the user had
> entered it directly on the command line.
	Allow the value of the configuration variable and the
	command line option to be prefixed with a '!' to signal that
	the specified command needs to be looked up on $PATH.
> See also https://lore.kernel.org/git/YJrH8uqzapnpNEsb@gpanders.com/.

You summarised the problem description in that message pretty well in the proposed log message (which is much better than leaving only a URL and forcing readers to go there), and I suspect there aren't much readers can learn from by seeing also the article, though.

Show 10 quoted lines
> +	} elsif (file_name_is_absolute($smtp_server) || $smtp_server =~ /^!/) {
> +		my $prog = $smtp_server;
> +		$prog =~ s/^!//;
> +
>  		my $pid = open my $sm, '|-';
>  		defined $pid or die $!;
>  		if (!$pid) {
> -			exec($smtp_server, @sendmail_parameters) or die $!;
> +			exec($prog, @sendmail_parameters) or die $!;
>  		}
Looking good.
Thanks.
Previous: Gregory AndersNext: Gregory Anders
Message 6 of 23 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. git-send-email: use ! to indicate relative path to commandGregory Anders, May 11, 2021
  4. Jeff KingMay 11, 2021
  5. Gregory AndersMay 11, 2021
  6. Junio C HamanoMay 11, 2021
  7. git-send-email: use ! to indicate relative path to commandGregory Anders, May 11, 2021
  8. brian m. carlsonMay 12, 2021
  9. Jeff KingMay 12, 2021
  10. Gregory AndersMay 12, 2021
  11. Jeff KingMay 12, 2021
  12. Junio C HamanoMay 12, 2021
  13. brian m. carlsonMay 12, 2021
  14. Felipe ContrerasMay 11, 2021
  15. Gregory AndersMay 11, 2021
  16. Felipe ContrerasMay 11, 2021
  17. Gregory AndersMay 11, 2021
  18. Jeff KingMay 12, 2021
  19. Felipe ContrerasMay 12, 2021
  20. Jeff KingMay 12, 2021
  21. Felipe ContrerasMay 12, 2021
  22. Gregory AndersMay 12, 2021
  23. Felipe ContrerasMay 12, 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.