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@xxxxxxxxx> --- [[ 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