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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gregory Anders <greg@xxxxxxxxxxxx> 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@xxxxxxxxxxxx/.

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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux