1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 20:36:15 +02:00

Add --dry-run option to git-send-email

Add a --dry-run option to git-send-email due to having made too many
mistakes with it in the past week.  I like having a safety catch on my
machine gun.

Signed-off-by: Matthew @ilcox <matthew@wil.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Matthew Wilcox 2006-10-10 08:58:23 -06:00 committed by Junio C Hamano
parent 0503f9c178
commit 6130259c30

View File

@ -87,7 +87,8 @@ sub format_2822_time {
$initial_reply_to,$initial_subject,@files,$from,$compose,$time); $initial_reply_to,$initial_subject,@files,$from,$compose,$time);
# Behavior modification variables # Behavior modification variables
my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc) = (1, 0, 0, 0); my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
$dry_run) = (1, 0, 0, 0, 0);
my $smtp_server; my $smtp_server;
# Example reply to: # Example reply to:
@ -116,6 +117,7 @@ sub format_2822_time {
"quiet" => \$quiet, "quiet" => \$quiet,
"suppress-from" => \$suppress_from, "suppress-from" => \$suppress_from,
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc, "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
"dry-run" => \$dry_run,
); );
# Verify the user input # Verify the user input
@ -423,7 +425,9 @@ sub send_message
$header .= "References: $references\n"; $header .= "References: $references\n";
} }
if ($smtp_server =~ m#^/#) { if ($dry_run) {
# We don't want to send the email.
} elsif ($smtp_server =~ m#^/#) {
my $pid = open my $sm, '|-'; my $pid = open my $sm, '|-';
defined $pid or die $!; defined $pid or die $!;
if (!$pid) { if (!$pid) {