git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] send-email: remove support for deprecated sendemail.smtpssl

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 17, 2019, 19:55 UTC
Message-ID
<20190517195545.29729-6-avarab@gmail.com>
In-Reply-To
<xmqqsgtd3fw3.fsf@gitster-ct.c.googlers.com>

Remove the sendemail.smtpssl configuration variable and its associated --smtp-ssl command-line option. This has been documented as deprecated since f6bebd121a ("git-send-email: add support for TLS via Net::SMTP::SSL", 2008-06-25) and 65180c6618 ("List send-email config options in config.txt.", 2009-07-22), respectively. Waiting for 10 years should be enough.

This allows us to fix a special case in read_config(). We couldn't just parse sendemail.smtpEncryption like everything else because we'd need to fall back on sendemail.smtpssl. Now that we don't need to do that we don't need this special case anymore. Let's still find out if someone's using this and die() with a helpful message if that's the case.

Because of my recent improvements to the command-line and config parsing we can also revert fa835cd572 ("git-send-email: prevent undefined variable warnings if no encryption is set", 2008-06-26), since we now sensibly support setting defaults for these mixed config & command-line options.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Documentation/config/sendemail.txt |  3 ---
 Documentation/git-send-email.txt   |  3 ---
 git-send-email.perl                | 26 +++++++++-----------------
 t/t9001-send-email.sh              |  9 +++++++++
 4 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/Documentation/config/sendemail.txt b/Documentation/config/sendemail.txt
index 0006faf800..d7855bff1f 100644
--- a/Documentation/config/sendemail.txt
+++ b/Documentation/config/sendemail.txt
@@ -8,9 +8,6 @@ sendemail.smtpEncryption::
 	See linkgit:git-send-email[1] for description.  Note that this
 	setting is not subject to the 'identity' mechanism.
 
-sendemail.smtpssl (deprecated)::
-	Deprecated alias for 'sendemail.smtpEncryption = ssl'.
-
 sendemail.smtpsslcertpath::
 	Path to ca-certificates (either a directory or a single file).
 	Set it to an empty string to disable certificate verification.
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index a861934c69..6cf5c32ce8 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -236,9 +236,6 @@ The --smtp-server-option option must be repeated for each option you want
 to pass to the server. Likewise, different lines in the configuration files
 must be used for each option.
 
---smtp-ssl::
-	Legacy alias for '--smtp-encryption ssl'.
-
 --smtp-ssl-cert-path::
 	Path to a store of trusted CA certificates for SMTP SSL/TLS
 	certificate validation (either a directory that has been processed
diff --git a/git-send-email.perl b/git-send-email.perl
index 80cbbfd2b8..b1ed45b907 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -77,7 +77,6 @@ sub usage {
     --smtp-user             <str>  * Username for SMTP-AUTH.
     --smtp-pass             <str>  * Password for SMTP-AUTH; not necessary.
     --smtp-encryption       <str>  * tls or ssl; anything else disables.
-    --smtp-ssl                     * Deprecated. Use '--smtp-encryption ssl'.
     --smtp-ssl-cert-path    <str>  * Path to ca-certificates (either directory or file).
                                      Pass an empty string to disable certificate
                                      verification.
@@ -236,7 +235,7 @@ sub do_edit {
 my ($cover_cc, $cover_to);
 my ($to_cmd, $cc_cmd);
 my ($smtp_server, $smtp_server_port, @smtp_server_options);
-my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
+my ($smtp_authuser, $smtp_ssl_cert_path);
 my ($batch_size, $relogin_delay);
 my ($identity, $aliasfiletype, @alias_files, $smtp_domain, $smtp_auth);
 my ($confirm);
@@ -250,6 +249,9 @@ sub do_edit {
 my $use_xmailer = 1;
 my $validate = 1;
 my $target_xfer_encoding = 'auto';
+my $smtp_encryption = '';
+# Deprecated variables
+my $deprecated_smtp_ssl;
 
 my %config_bool_settings = (
     "thread" => \$thread,
@@ -266,10 +268,12 @@ sub do_edit {
 );
 
 my %config_settings = (
+    "smtpencryption" => \$smtp_encryption,
     "smtpserver" => \$smtp_server,
     "smtpserverport" => \$smtp_server_port,
     "smtpserveroption" => \@smtp_server_options,
     "smtpuser" => \$smtp_authuser,
+    "smtpssl" => \$deprecated_smtp_ssl,
     "smtppass" => \$smtp_authpass,
     "smtpdomain" => \$smtp_domain,
     "smtpauth" => \$smtp_auth,
@@ -366,18 +370,6 @@ sub read_config {
 			$$target = $v;
 		}
 	}
-
-	if (!defined $smtp_encryption) {
-		my $setting = "$prefix.smtpencryption";
-		my $enc = Git::config(@repo, $setting);
-		return unless defined $enc;
-		return if $configured->{$setting}++;
-		if (defined $enc) {
-			$smtp_encryption = $enc;
-		} elsif (Git::config_bool(@repo, "$prefix.smtpssl")) {
-			$smtp_encryption = 'ssl';
-		}
-	}
 }
 
 # sendemail.identity yields to --identity. We must parse this
@@ -426,7 +418,7 @@ sub read_config {
 		    "smtp-server-port=s" => \$smtp_server_port,
 		    "smtp-user=s" => \$smtp_authuser,
 		    "smtp-pass:s" => \$smtp_authpass,
-		    "smtp-ssl" => sub { $smtp_encryption = 'ssl' },
+		    "smtp-ssl" => sub { $deprecated_smtp_ssl = 1 },
 		    "smtp-encryption=s" => \$smtp_encryption,
 		    "smtp-ssl-cert-path=s" => \$smtp_ssl_cert_path,
 		    "smtp-debug:i" => \$debug_net_smtp,
@@ -484,8 +476,8 @@ sub read_config {
 	"(via command-line or configuration option)\n")
 	if defined $relogin_delay and not defined $batch_size;
 
-# 'default' encryption is none -- this only prevents a warning
-$smtp_encryption = '' unless (defined $smtp_encryption);
+die __("Use of deprecated option --smtp-ssl (or smtp.smtpssl config), use --smtp-encryption=ssl (or sendemail.smtpEncryption=ssl) instead\n")
+	if $deprecated_smtp_ssl;
 
 # Set CC suppressions
 my(%suppress_cc);
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 890e2874c3..b5ccfa8737 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1849,6 +1849,15 @@ test_expect_success 'aliases and sendemail.identity' '
 	test_i18ngrep "cloud-aliases" stderr
 '
 
+test_expect_success 'deprecated --smtp-ssl (or sendemail.smtpssl=true)' '
+	test_must_fail git -c sendemail.smtpssl=true send-email -1 2>stderr &&
+	test_i18ngrep "deprecated option.*or.*config" stderr &&
+	test_must_fail git send-email --smtp-ssl -1 &&
+	test_i18ngrep "deprecated option.*or.*config" stderr &&
+	test_must_fail git -c sendemail.identity=test -c sendemail.test.smtpssl=true send-email -1 &&
+	test_i18ngrep "deprecated option.*or.*config" stderr
+'
+
 test_sendmail_aliases () {
 	msg="$1" && shift &&
 	expect="$@" &&
-- 
2.21.0.1020.gf2820cf01a
Previous: Johannes SchindelinNext: Junio C Hamano
Message 32 of 39 in “send-email: fix transferencoding config option”
  1. 1/1 send-email: fix transferencoding config optionHeinrich Schuchardt, Apr 9, 2019
  2. Jonathan NiederApr 9, 2019
  3. Heinrich SchuchardtApr 9, 2019
  4. Junio C HamanoApr 10, 2019
  5. Heinrich SchuchardtApr 10, 2019
  6. brian m. carlsonApr 10, 2019
  7. Re* [PATCH 1/1] send-email: fix transferencoding config optionJunio C Hamano, May 8, 2019
  8. 2/2 send-email: honor transferencoding config option againJunio C Hamano, May 8, 2019
  9. Junio C HamanoMay 8, 2019
  10. 0/2 send-email: set xfer encoding correctlyJunio C Hamano, May 8, 2019
  11. 0/3 send-email: fix cli->config parsing crazynessÆvar Arnfjörð Bjarmason, May 9, 2019
  12. Junio C HamanoMay 10, 2019
  13. 1/3 send-email: move the read_config() function above getoptsÆvar Arnfjörð Bjarmason, May 9, 2019
  14. 2/3 send-email: rename the @bcclist variable for consistencyÆvar Arnfjörð Bjarmason, May 9, 2019
  15. 3/3 send-email: do defaults -> config -> getopt in that orderÆvar Arnfjörð Bjarmason, May 9, 2019
  16. Eric SunshineMay 9, 2019
  17. Junio C HamanoMay 13, 2019
  18. brian m. carlsonMay 9, 2019
  19. Junio C HamanoMay 13, 2019
  20. Ævar Arnfjörð BjarmasonMay 13, 2019
  21. Stephen BoydMay 16, 2019
  22. Junio C HamanoMay 16, 2019
  23. Junio C HamanoMay 17, 2019
  24. 0/5 ab/send-email-transferencoding-fix-for-the-fixÆvar Arnfjörð Bjarmason, May 17, 2019
  25. 1/5 send-email: remove cargo-culted multi-patch pattern in testsÆvar Arnfjörð Bjarmason, May 17, 2019
  26. 2/5 send-email: fix broken transferEncoding testsÆvar Arnfjörð Bjarmason, May 17, 2019
  27. 3/5 send-email: document --no-[to|cc|bcc]Ævar Arnfjörð Bjarmason, May 17, 2019
  28. 4/5 send-email: fix regression in sendemail.identity parsingÆvar Arnfjörð Bjarmason, May 17, 2019
  29. Junio C HamanoMay 19, 2019
  30. Johannes SchindelinMay 22, 2019
  31. Johannes SchindelinMay 29, 2019
  32. 5/5 send-email: remove support for deprecated sendemail.smtpsslÆvar Arnfjörð Bjarmason, May 17, 2019
  33. 2/2 send-email: honor transferencoding config option againJunio C Hamano, May 8, 2019
  34. Eric SunshineMay 8, 2019
  35. Junio C HamanoMay 9, 2019
  36. brian m. carlsonMay 8, 2019
  37. 1/2 send-email: update the mechanism to set default configuration valuesJunio C Hamano, May 8, 2019
  38. brian m. carlsonApr 9, 2019
  39. Heinrich SchuchardtApr 9, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.