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

Re: [PATCH v2] send-email: add --confirm option

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2009, 02:47 UTC
Message-ID
<7v1vtfjpad.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1235924234-16923-1-git-send-email-jaysoffian@gmail.com>
Jay Soffian <jaysoffian@gmail.com> writes:
>  - When the user specifies "all" in response to a confirm prompt, we
>    hint them about how to use "sendemail.confirm" config setting.

I think the logic is wrong. Even when you have configured to usually ask, you may want to say "I know Cc settings for this particular series is all good, but I still want the safety in my future invocations.".

How about doing it this way instead?
Show 7 quoted lines
> @@ -346,6 +350,13 @@ if ($suppress_cc{'body'}) {
>  	delete $suppress_cc{'body'};
>  }
>  
> +# Set confirm
> +if (!defined $confirm) {
> +	$confirm = scalar %suppress_cc ? 'compose' : 'auto';

This is not "Set confirm" but "set the default value to $confirm". Also set $confirm_unconfigured = "true" here.

> @@ -837,6 +836,27 @@ X-Mailer: git-send-email $gitversion
>  	unshift (@sendmail_parameters,
>  			'-f', $raw_from) if(defined $envelope_sender);
> +	if ($needs_confirm && !$dry_run) {

And use it here; give some help for people who haven't seen this new message and haven't decided:

	    if (!$confirm_unconfigured) {
		print "By default the command asks if you are sure about\n";
		print "the CC list computed from various places.  If you\n";
                print "do not want this confirmation step, you can say\n";
                print "    $ git config --global sendemail.confirm never\n";
                print "to squelch it.\n";
		print "A good setting might be:\n";
                print "    $ git config --global sendemail.confirm auto\n";
		print "to squelch this help text that is given until you\n";
		print "configure the variable to some value.\n";
	    }
Show 15 quoted lines
> +		print "\n$header\n";
> +		while (1) {
> +			chomp ($_ = $term->readline(
> +				"Send this email? ([y]es|[n]o|[q]uit|[a]ll): "
> +			));
> +			last if /^(?:yes|y|no|n|quit|q|all|a)/i;
> +			print "\n";
> +		}
> +		if (/^n/i) {
> +			return;
> +		} elsif (/^q/i) {
> +			cleanup_compose_files();
> +			exit(0);
> +		} elsif (/^a/i) {
> +			$confirm = 'never';
And drop the following two:
> +			print "You may disable all future prompting via sendemail.confirm;\n";
> +			print "Run 'git send-email --help' for details.\n";
> +		}
> +	}
Previous: Jay SoffianNext: Jay Soffian
Message 14 of 22 in “send-email: add --confirm option”
  1. send-email: add --confirm optionJay Soffian, Mar 1, 2009
  2. Junio C HamanoMar 1, 2009
  3. Jay SoffianMar 1, 2009
  4. send-email: add --confirm optionJay Soffian, Mar 1, 2009
  5. Paul GortmakerMar 1, 2009
  6. Jay SoffianMar 1, 2009
  7. Nanako ShiraishiMar 2, 2009
  8. Junio C HamanoMar 2, 2009
  9. Nanako ShiraishiMar 2, 2009
  10. Felipe ContrerasMar 2, 2009
  11. Jay SoffianMar 2, 2009
  12. Junio C HamanoMar 2, 2009
  13. Jay SoffianMar 2, 2009
  14. Junio C HamanoMar 3, 2009
  15. send-email: add --confirm option and configuration settingJay Soffian, Mar 3, 2009
  16. Junio C HamanoMar 3, 2009
  17. Nanako ShiraishiMar 3, 2009
  18. Bert WesargMar 3, 2009
  19. Jay SoffianMar 3, 2009
  20. Junio C HamanoMar 3, 2009
  21. Bert WesargMar 3, 2009
  22. Jay SoffianMar 3, 2009

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.