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

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

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 12, 2021, 00:00 UTC
Message-ID
<YJsas0d4XPsYYpI7@camp.crustytoothpaste.net>
In-Reply-To
<20210511234935.65147-1-greg@gpanders.com>
On 2021-05-11 at 23:49:35, Gregory Anders wrote:
Show 20 quoted lines
> The sendemail.smtpServer configuration option and the '--smtp-server'
> command line option can name a program to use by providing an absolute
> path to the program. 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.
> 
> To that end, this patch allows both the configuration and command line
> options to be prefixed with a '!' character to indicate that the
> specified command should be found on $PATH, as if the user had entered
> it directly on the command line.

I think the idea of providing a way to invoke a sendmail-compatible mail server is a good idea.

Show 36 quoted lines
> Signed-off-by: Gregory Anders <greg@gpanders.com>
> ---
> Diff from v4:
> 
> * Update the test with suggestions from Jeff King (this should fix 
>   erroneous test failures caused by patch files being deleted by earlier 
>   tests)
> * Reword the commit message with feedback from Jeff King and Junio 
>   Hamano
> 
>  Documentation/git-send-email.txt | 13 +++++++------
>  git-send-email.perl              |  7 +++++--
>  t/t9001-send-email.sh            | 12 ++++++++++++
>  3 files changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
> index 93708aefea..418e66c703 100644
> --- a/Documentation/git-send-email.txt
> +++ b/Documentation/git-send-email.txt
> @@ -212,12 +212,13 @@ a password is obtained using 'git-credential'.
>  --smtp-server=<host>::
>  	If set, specifies the outgoing SMTP server to use (e.g.
>  	`smtp.example.com` or a raw IP address).  Alternatively it can
> -	specify a full pathname of a sendmail-like program instead;
> -	the program must support the `-i` option.  Default value can
> -	be specified by the `sendemail.smtpServer` configuration
> -	option; the built-in default is to search for `sendmail` in
> -	`/usr/sbin`, `/usr/lib` and $PATH if such program is
> -	available, falling back to `localhost` otherwise.
> +	specify a sendmail-like program instead, either by a full
> +	path-name or by prefixing the program name with `!`.  The
> +	program must support the `-i` option.  Default value can be
> +	specified by the `sendemail.smtpServer` configuration option;
> +	the built-in default is to search for `sendmail` in `/usr/sbin`,
> +	`/usr/lib` and $PATH if such program is available, falling back
> +	to `localhost` otherwise.

Elsewhere we use the ! syntax we invoke the shell, and I would suggest that we do the same here. That means we'll get PATH functionality by default and we'll let people do a modicum of scripting if they like.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Gregory AndersNext: Jeff King
Message 8 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.