aboutsummaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-10-10 08:58:23 -0600
committerJunio C Hamano <junkio@cox.net>2006-10-11 01:18:57 -0700
commit6130259c30695d8a6ceda414a7d0d14183491e82 (patch)
tree46afae6ca9905fd49ba3fdc27fc31601e45f9de0 /git-send-email.perl
parent0503f9c178c36a19e1f8e8930b367db0f58ce5ca (diff)
downloadgit-6130259c30695d8a6ceda414a7d0d14183491e82.tar.gz
git-6130259c30695d8a6ceda414a7d0d14183491e82.tar.xz
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>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 3f50abaeb..04c894225 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -87,7 +87,8 @@ my (@to,@cc,@initial_cc,@bcclist,
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
# 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;
# Example reply to:
@@ -116,6 +117,7 @@ my $rc = GetOptions("from=s" => \$from,
"quiet" => \$quiet,
"suppress-from" => \$suppress_from,
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
+ "dry-run" => \$dry_run,
);
# Verify the user input
@@ -423,7 +425,9 @@ X-Mailer: git-send-email $gitversion
$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, '|-';
defined $pid or die $!;
if (!$pid) {