send-email config path expansion
cover send-email config path expansion
These two patches enable tilde-expansion for a few more config variables in git-send-email.
The first case is the one that surprised me when it didn't work, the second two are the other ones that look like they should be handled as paths.
John Keeping (2):
send-email: expand path in sendemail.smtpsslcertpath config
send-email: expand paths in sendemail.{to,cc}cmd config
git-send-email.perl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.6.3.462.gbe2c914
PATCH 1/2 send-email: expand path in sendemail.smtpsslcertpath config
As it says in the name, the SSL certificate path is a path so treat it as one and support tilde-expansion.
--- git-send-email.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
git-send-email.perl +1 -1
@@ -239,7 +239,6 @@ my %config_settings = ( "smtpserveroption" => \@smtp_server_options, "smtpuser" => \$smtp_authuser, "smtppass" => \$smtp_authpass, - "smtpsslcertpath" => \$smtp_ssl_cert_path, "smtpdomain" => \$smtp_domain, "smtpauth" => \$smtp_auth, "to" => \@initial_to,
@@ -259,6 +258,7 @@ my %config_settings = ( my %config_path_settings = ( "aliasesfile" => \@alias_files, + "smtpsslcertpath" => \$smtp_ssl_cert_path, ); # Handle Uncouth Termination
Signature · 1 line
2.6.3.462.gbe2c914
PATCH 2/2 send-email: expand paths in sendemail.{to,cc}cmd config
In reply to John KeepingThese configuration variables specify the paths to commands so we should support tilde-expansion for files inside a user's home directory.
--- git-send-email.perl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
git-send-email.perl +2 -2
@@ -242,9 +242,7 @@ my %config_settings = ( "smtpdomain" => \$smtp_domain, "smtpauth" => \$smtp_auth, "to" => \@initial_to, - "tocmd" => \$to_cmd, "cc" => \@initial_cc, - "cccmd" => \$cc_cmd, "aliasfiletype" => \$aliasfiletype, "bcc" => \@bcclist, "suppresscc" => \@suppress_cc,
@@ -259,6 +257,8 @@ my %config_settings = ( my %config_path_settings = ( "aliasesfile" => \@alias_files, "smtpsslcertpath" => \$smtp_ssl_cert_path, + "tocmd" => \$to_cmd, + "cccmd" => \$cc_cmd, ); # Handle Uncouth Termination
Signature · 1 line
2.6.3.462.gbe2c914
Re: [PATCH 2/2] send-email: expand paths in sendemail.{to,cc}cmd config
Quoted 2 lines · John Keeping
These configuration variables specify the paths to commands so we should support tilde-expansion for files inside a user's home directory.
Hmm, I don't see anything in the documentation which says that these are paths to commands, and the code itself treats them purely as commands to be invoked, not as paths to commands. What is the behavior, for instance, with --tocmd='foobar -x zopp' or even --tocmd='foobar -x ~/zopp'?
Quoted 23 lines
Signed-off-by John Keeping <[email protected]>---
git-send-email.perl +2
-2@@ -242,9 +242,7 @@ my %config_settings = ( "smtpdomain" => \$smtp_domain, "smtpauth" => \$smtp_auth, "to" => \@initial_to, - "tocmd" => \$to_cmd, "cc" => \@initial_cc, - "cccmd" => \$cc_cmd, "aliasfiletype" => \$aliasfiletype, "bcc" => \@bcclist, "suppresscc" => \@suppress_cc,@@ -259,6 +257,8 @@ my %config_settings = ( my %config_path_settings = ( "aliasesfile" => \@alias_files, "smtpsslcertpath" => \$smtp_ssl_cert_path, + "tocmd" => \$to_cmd, + "cccmd" => \$cc_cmd, );
Re: [PATCH 2/2] send-email: expand paths in sendemail.{to,cc}cmd config
Quoted 9 lines · Eric Sunshine
Quoted 2 lines · John Keeping
These configuration variables specify the paths to commands so we should support tilde-expansion for files inside a user's home directory.
Hmm, I don't see anything in the documentation which says that these are paths to commands, and the code itself treats them purely as commands to be invoked, not as paths to commands. What is the behavior, for instance, with --tocmd='foobar -x zopp' or even --tocmd='foobar -x ~/zopp'?
The path behaviour only expands leading '~' and '~user' (as documented in git-config(1)):
$ git -c sendemail.tocmd='foobar -x ~/zopp' config --path sendemail.tocmd foobar -x ~/zopp
Quoted 23 lines
Quoted 23 lines
Signed-off-by John Keeping <[email protected]>---
git-send-email.perl +2
-2@@ -242,9 +242,7 @@ my %config_settings = ( "smtpdomain" => \$smtp_domain, "smtpauth" => \$smtp_auth, "to" => \@initial_to, - "tocmd" => \$to_cmd, "cc" => \@initial_cc, - "cccmd" => \$cc_cmd, "aliasfiletype" => \$aliasfiletype, "bcc" => \@bcclist, "suppresscc" => \@suppress_cc,@@ -259,6 +257,8 @@ my %config_settings = ( my %config_path_settings = ( "aliasesfile" => \@alias_files, "smtpsslcertpath" => \$smtp_ssl_cert_path, + "tocmd" => \$to_cmd, + "cccmd" => \$cc_cmd, );
Re: [PATCH 2/2] send-email: expand paths in sendemail.{to,cc}cmd config
Quoted 11 lines · John Keeping
Quoted 9 lines · Eric Sunshine
Quoted 2 lines · John Keeping
These configuration variables specify the paths to commands so we should support tilde-expansion for files inside a user's home directory.
Hmm, I don't see anything in the documentation which says that these are paths to commands, and the code itself treats them purely as commands to be invoked, not as paths to commands. What is the behavior, for instance, with --tocmd='foobar -x zopp' or even --tocmd='foobar -x ~/zopp'?
Quoted 5 lines
The path behaviour only expands leading '~' and '~user' (as documented in git-config(1)):
$ git -c sendemail.tocmd='foobar -x ~/zopp' config --path sendemail.tocmd foobar -x ~/zopp
We usually run user-supplied commands with a shell (and AFAICT, that is the case here). So wouldn't that turn into (when used by send-email):
sh -c 'foobar -x ~/zopp'
and the shell would expand it for us? Running:
git -c sendemail.tocmd='echo ~/foo' send-email -1
seems to work for me (it puts "/home/peff/foo" into the "to" header).
-Peff
Re: [PATCH 2/2] send-email: expand paths in sendemail.{to,cc}cmd config
Quoted 22 lines · Jeff King
Quoted 11 lines · John Keeping
Quoted 9 lines · Eric Sunshine
Quoted 2 lines · John Keeping
These configuration variables specify the paths to commands so we should support tilde-expansion for files inside a user's home directory.
Hmm, I don't see anything in the documentation which says that these are paths to commands, and the code itself treats them purely as commands to be invoked, not as paths to commands. What is the behavior, for instance, with --tocmd='foobar -x zopp' or even --tocmd='foobar -x ~/zopp'?
Quoted 5 lines
The path behaviour only expands leading '~' and '~user' (as documented in git-config(1)):
$ git -c sendemail.tocmd='foobar -x ~/zopp' config --path sendemail.tocmd foobar -x ~/zoppWe usually run user-supplied commands with a shell (and AFAICT, that is the case here). So wouldn't that turn into (when used by send-email):
Quoted 7 lines
sh -c 'foobar -x ~/zopp'
and the shell would expand it for us? Running:
git -c sendemail.tocmd='echo ~/foo' send-email -1
seems to work for me (it puts "
/home/peff/foo" into the "to" header).
Ah, I hadn't tested it. We can drop this patch then.