git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: git@vger.kernel.org
Subject: [PATCH] Add --dry-run option to git-send-email
Date: Tue, 10 Oct 2006 08:58:23 -0600	[thread overview]
Message-ID: <20061010145823.GB8993@parisc-linux.org> (raw)


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>

--- /usr/bin/git-send-email	2006-07-29 09:52:13.000000000 -0600
+++ ./git-send-email.perl	2006-10-10 08:46:13.000000000 -0600
@@ -40,7 +40,8 @@
 	$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:
@@ -63,6 +64,7 @@
 		    "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
@@ -395,7 +397,9 @@
 		$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) {

             reply	other threads:[~2006-10-10 14:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-10 14:58 Matthew Wilcox [this message]
2006-10-10 17:44 ` [PATCH] Add --dry-run option to git-send-email Junio C Hamano
2006-10-10 21:03 ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061010145823.GB8993@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).