]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-send-email.perl
config: improve error message for boolean config
[thirdparty/git.git] / git-send-email.perl
index dc95656f75c1c4a066665b91d31b387936998961..1f425c08091d400e1d2e94533411c1b778f561de 100755 (executable)
@@ -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;
 
@@ -1699,10 +1707,14 @@ sub process_file {
                                $xfer_encoding = $1 if not defined $xfer_encoding;
                        }
                        elsif (/^In-Reply-To: (.*)/i) {
-                               $in_reply_to = $1;
+                               if (!$initial_in_reply_to || $thread) {
+                                       $in_reply_to = $1;
+                               }
                        }
                        elsif (/^References: (.*)/i) {
-                               $references = $1;
+                               if (!$initial_in_reply_to || $thread) {
+                                       $references = $1;
+                               }
                        }
                        elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
                                push @xh, $_;