All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Gregory Anders <greg@gpanders.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH v4] git-send-email: use ! to indicate relative path to command
Date: Wed, 12 May 2021 08:09:10 +0900	[thread overview]
Message-ID: <xmqqk0o4j2ax.fsf@gitster.g> (raw)
In-Reply-To: <20210511204044.69047-1-greg@gpanders.com> (Gregory Anders's message of "Tue, 11 May 2021 14:40:44 -0600")

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 ...

> 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.

> +	} 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.

  parent reply	other threads:[~2021-05-11 23:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 19:15 [PATCH v3] git-send-email: use ! to indicate relative path to command Gregory Anders
2021-05-11 19:24 ` Jeff King
2021-05-11 20:40   ` [PATCH v4] " Gregory Anders
2021-05-11 21:39     ` Jeff King
2021-05-11 22:18       ` Gregory Anders
2021-05-11 23:09     ` Junio C Hamano [this message]
2021-05-11 23:49     ` [PATCH v5] " Gregory Anders
2021-05-12  0:00       ` brian m. carlson
2021-05-12  0:35         ` Jeff King
2021-05-12  0:45           ` Gregory Anders
2021-05-12  0:49             ` Jeff King
2021-05-12  3:29             ` Junio C Hamano
2021-05-12  0:51           ` brian m. carlson
2021-05-11 20:03 ` [PATCH v3] " Felipe Contreras
2021-05-11 20:42   ` Gregory Anders
2021-05-11 22:07     ` Felipe Contreras
2021-05-11 22:19       ` Gregory Anders
2021-05-12  0:47         ` Jeff King
2021-05-12  1:08           ` Felipe Contreras
2021-05-12  1:24             ` Jeff King
2021-05-12  1:52               ` Felipe Contreras
2021-05-12  1:58                 ` Gregory Anders
2021-05-12  4:17                   ` Felipe Contreras

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=xmqqk0o4j2ax.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=greg@gpanders.com \
    --cc=peff@peff.net \
    /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.