git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH] send-email: allow a custom hook to prevent sending email

From
Stefan Beller <sbeller@google.com>
Date
Dec 9, 2016, 20:34 UTC
Message-ID
<20161209203449.17940-1-sbeller@google.com>

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
Next: Junio C Hamano
Message 1 of 9 in “send-email: allow a custom hook to prevent sending email”
  1. send-email: allow a custom hook to prevent sending emailStefan Beller, Dec 9, 2016
  2. Junio C HamanoDec 9, 2016
  3. Stefan BellerDec 9, 2016
  4. Junio C HamanoDec 9, 2016
  5. Stefan BellerDec 9, 2016
  6. Junio C HamanoDec 10, 2016
  7. Jeff KingDec 10, 2016
  8. Stefan BellerDec 12, 2016
  9. Junio C HamanoDec 12, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.