From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: bmwill@google.com, peff@peff.net, git@vger.kernel.org
Subject: Re: [RFC PATCH] send-email: allow a custom hook to prevent sending email
Date: Fri, 09 Dec 2016 14:36:37 -0800 [thread overview]
Message-ID: <xmqqfulwraq2.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161209203449.17940-1-sbeller@google.com> (Stefan Beller's message of "Fri, 9 Dec 2016 12:34:49 -0800")
Stefan Beller <sbeller@google.com> writes:
> 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";
> + }
> + }
> }
I doubt that this is the best place to call this hook, because the
called hook does not have access to information that may help it
make a better decision.
For example, because the hook gets one patchfile at a time, it does
not have the entire picture (e.g. "are you sure you want 01/05,
02/05, 04/05 and 05/05 without 03/05?"). For another example, the
hook does not have access to the decision git-send-email makes on
various "parameters", which are computed based on the contents of
the patchfiles and command line arguments at this point in the code.
(e.g. @to, @cc, etc. are computed much later, so you cannot say "do
not send anythnng outside corp by mistake" with this mechanism).
next prev parent reply other threads:[~2016-12-09 22:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=xmqqfulwraq2.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=sbeller@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.