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

[PATCH] send-email: always confirm by default

From
Alyssa Ross <hi@alyssa.is>
Date
Apr 22, 2022, 08:36 UTC
Message-ID
<20220422083629.1404989-1-hi@alyssa.is>
In-Reply-To
<220421.86tuam5hoi.gmgdl@evledraar.gmail.com>

For novice users, it can be very intimidating for git send-email to send off a lot of mail without prompting for confirmation. These users are likely to not know it's even possible to configure git to behave differently. So let's set a novice-friendly default — expert users who don't need to be prompted every time will be able to set sendemail.confirm to their preference, although from my small sample it sounds plenty of expert users already rely on sendemail.confirm = always.

I think this is a better idea than defaulting to --dry-run, because having to specify on the command line that you _really_ want to send the patches now would mean the --no-dry-run version would quickly end up being replayed unthinkingly from shell history, and because always confirming has the nice side effect of making it easy to add patch commentary.

I also think this approach is better than forbidding the all-in-one format-patch + send-email, because it wouldn't give an accurate preview of recipients, because automatic CCs are added by send-email, not format-patch. Additionally, teaching git send-email is hard enough without having to also teach format-patch, and to make sure to clean up afterwards, etc!

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
[[ Whoops, sent to the list this time! ]]

Ævar, thanks for encouraging me to send a patch. At your suggestion, I've trawled through the list archives looking for any previous discussion of this default, but I didn't find anything.

 Documentation/git-send-email.txt |  3 +--
 git-send-email.perl              |  2 +-
 t/t9001-send-email.sh            | 14 ++++----------
 3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 41cd8cb424..b791d83bb7 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -407,8 +407,7 @@ Administering
 --
 +
 Default is the value of `sendemail.confirm` configuration value; if that
-is unspecified, default to 'auto' unless any of the suppress options
-have been specified, in which case default to 'compose'.
+is unspecified, default to 'always'.
 
 --dry-run::
 	Do everything except actually send the emails.
diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..4aa7d83cdc 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -606,7 +606,7 @@ sub config_regexp {
 # Set confirm's default value
 my $confirm_unconfigured = !defined $confirm;
 if ($confirm_unconfigured) {
-	$confirm = scalar %suppress_cc ? 'compose' : 'auto';
+	$confirm = 'always';
 };
 # Please update $__git_send_email_confirm_options in
 # git-completion.bash when you add new options.
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 42694fe584..e11730f3dc 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -74,8 +74,8 @@ check_no_confirm () {
 	return 0
 }
 
-test_expect_success $PREREQ 'No confirm with --suppress-cc' '
-	test_no_confirm --suppress-cc=sob &&
+test_expect_success $PREREQ 'No confirm with --confirm=compose --suppress-cc' '
+	test_no_confirm --confirm=compose --suppress-cc=sob &&
 	check_no_confirm
 '
 
@@ -1032,16 +1032,10 @@ test_expect_success $PREREQ '--confirm=compose' '
 	test_confirm --confirm=compose --compose
 '
 
-test_expect_success $PREREQ 'confirm by default (due to cc)' '
+test_expect_success $PREREQ 'confirm by default' '
 	test_when_finished git config sendemail.confirm never &&
 	git config --unset sendemail.confirm &&
-	test_confirm
-'
-
-test_expect_success $PREREQ 'confirm by default (due to --compose)' '
-	test_when_finished git config sendemail.confirm never &&
-	git config --unset sendemail.confirm &&
-	test_confirm --suppress-cc=all --compose
+	test_confirm --suppress-cc=all
 '
 
 test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '

base-commit: 6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e
-- 
2.35.1
Previous: Alyssa RossNext: Ævar Arnfjörð Bjarmason
Message 11 of 15 in “Should sendemail.confirm default to always?”
  1. Alyssa RossApr 21, 2022
  2. Ævar Arnfjörð BjarmasonApr 21, 2022
  3. Junio C HamanoApr 21, 2022
  4. Failures in t9001-send-emailAlyssa Ross, Apr 21, 2022
  5. rsbecker@nexbridge.comApr 21, 2022
  6. Alyssa RossApr 22, 2022
  7. rsbecker@nexbridge.comApr 22, 2022
  8. Johannes SixtApr 22, 2022
  9. Junio C HamanoApr 22, 2022
  10. Alyssa RossApr 22, 2022
  11. send-email: always confirm by defaultAlyssa Ross, Apr 22, 2022
  12. Ævar Arnfjörð BjarmasonApr 22, 2022
  13. Junio C HamanoApr 22, 2022
  14. Junio C HamanoApr 21, 2022
  15. Alyssa RossApr 21, 2022

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.