summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-07-24 00:44:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-07-24 01:00:34 (GMT)
commitdd84e528a34c3822e7ab0473a95e411665b37681 (patch)
tree92ec8f5e78e1aeac2be748dcf0262a370cc228cb /git-send-email.perl
parent3d20111cbd42c9ef3116bb629838bcbfea508cda (diff)
downloadgit-dd84e528a34c3822e7ab0473a95e411665b37681.zip
git-dd84e528a34c3822e7ab0473a95e411665b37681.tar.gz
git-dd84e528a34c3822e7ab0473a95e411665b37681.tar.bz2
git-send-email: die if sendmail.* config is set
I've seen several people mis-configure git send-email on their first attempt because they set the sendmail.* config options - not sendemail.*. This patch detects this mistake and bails out with a friendly warning. Signed-off-by: Drew DeVault <sir@cmpwn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 36c47ba..1f425c0 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -250,6 +250,7 @@ my $chain_reply_to = 0;
my $use_xmailer = 1;
my $validate = 1;
my $target_xfer_encoding = 'auto';
+my $forbid_sendmail_variables = 1;
my %config_bool_settings = (
"thread" => \$thread,
@@ -263,6 +264,7 @@ my %config_bool_settings = (
"multiedit" => \$multiedit,
"annotate" => \$annotate,
"xmailer" => \$use_xmailer,
+ "forbidsendmailvariables" => \$forbid_sendmail_variables,
);
my %config_settings = (
@@ -478,6 +480,12 @@ unless ($rc) {
usage();
}
+if ($forbid_sendmail_variables && (scalar Git::config_regexp("^sendmail[.]")) != 0) {
+ die __("fatal: found configuration options for 'sendmail'\n" .
+ "git-send-email is configured with the sendemail.* options - note the 'e'.\n" .
+ "Set sendemail.forbidSendmailVariables to false to disable this check.\n");
+}
+
die __("Cannot run git format-patch from outside a repository\n")
if $format_patch and not $repo;