git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] send-email: allow a custom hook to prevent sending email
@ 2016-12-09 20:34 Stefan Beller
  2016-12-09 22:36 ` Junio C Hamano
  2016-12-10  9:13 ` Jeff King
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Beller @ 2016-12-09 20:34 UTC (permalink / raw)
  To: bmwill, peff; +Cc: git, Stefan Beller

This custom hook could be used to prevent sending out e.g. patches
with change ids or other information that upstream doesn't like to see
or is not supposed to see.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

My first perl contribution to Git. :)

Marked as RFC to gauge general interest before writing tests and documentation.

Thanks,
Stefan

 git-send-email.perl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index da81be40cb..d3ebf666c3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -815,6 +815,15 @@ if (!$force) {
 				. "Pass --force if you really want to send.\n";
 		}
 	}
+	my @hook = ( $ENV{GIT_DIR}.'hooks/send-email', $f )
+	if( -x $hook[0] ) {
+		unless( system( @hook ) == 0 )
+		{
+			die "Refusing to send because the patch\n\t$f\n"
+				. "was refused by the send-email hook."
+				. "Pass --force if you really want to send.\n";
+		}
+	}
 }
 
 if (defined $sender) {
-- 
2.11.0.rc2.49.ge1f3b0c.dirty


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

end of thread, other threads:[~2016-12-12 22:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-09 20:34 [RFC PATCH] send-email: allow a custom hook to prevent sending email Stefan Beller
2016-12-09 22:36 ` Junio C Hamano
2016-12-09 22:53   ` Stefan Beller
2016-12-09 23:52     ` Junio C Hamano
2016-12-09 23:56       ` Stefan Beller
2016-12-10 22:11         ` Junio C Hamano
2016-12-10  9:13 ` Jeff King
2016-12-12 19:35   ` Stefan Beller
2016-12-12 22:38     ` Junio C Hamano

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