git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add --dry-run option to git-send-email
@ 2006-10-10 14:58 Matthew Wilcox
  2006-10-10 17:44 ` Junio C Hamano
  2006-10-10 21:03 ` Jakub Narebski
  0 siblings, 2 replies; 3+ messages in thread
From: Matthew Wilcox @ 2006-10-10 14:58 UTC (permalink / raw)
  To: git


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) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add --dry-run option to git-send-email
  2006-10-10 14:58 [PATCH] Add --dry-run option to git-send-email Matthew Wilcox
@ 2006-10-10 17:44 ` Junio C Hamano
  2006-10-10 21:03 ` Jakub Narebski
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2006-10-10 17:44 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: git

Matthew Wilcox <matthew@wil.cx> writes:

> 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>

Good.

When I have to look into other people's issues with send-email,
I used to say "--smtp-server=/var/tmp/send" which is this
script:

        #!/bin/sh
        for i
        do
                echo "arg $i"
        done
        sed -e 's/^/Msg: /'

I hope your patch makes the above hack unneeded (I want to see
what is fed to sendmail, what goes on the header and body).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add --dry-run option to git-send-email
  2006-10-10 14:58 [PATCH] Add --dry-run option to git-send-email Matthew Wilcox
  2006-10-10 17:44 ` Junio C Hamano
@ 2006-10-10 21:03 ` Jakub Narebski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2006-10-10 21:03 UTC (permalink / raw)
  To: git

Matthew Wilcox wrote:

> 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.

+1

I'd like also for git-send-email to check if there are any patches to send,
as I oftend did forgot to provide patches.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-10 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-10 14:58 [PATCH] Add --dry-run option to git-send-email Matthew Wilcox
2006-10-10 17:44 ` Junio C Hamano
2006-10-10 21:03 ` Jakub Narebski

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).