git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Satyakiran Duggina <satya0521@gmail.com>
Cc: Bryan Turner <bturner@atlassian.com>, Git Users <git@vger.kernel.org>
Subject: Re: Git Hooks
Date: Sat, 16 Dec 2017 04:53:58 -0500	[thread overview]
Message-ID: <20171216095357.GB32706@sigill.intra.peff.net> (raw)
In-Reply-To: <CAMZug26A0e=AunMOjZNC_xH2E5uqHe46mt6=jawWe7ozF=Jn0Q@mail.gmail.com>

On Fri, Dec 15, 2017 at 12:48:07PM -0800, Satyakiran Duggina wrote:

> To give the code pullers a chance to review, can we not have a
> `trusted-hooks: default` and `trusted-SHA: <some sha>` field in .git/.
> I'm assuming githooks/ are source tracked here.
> 
> When developer tries to execute `git commit`, git can ask developer to
> change `trusted-hooks` field to true or false. Let's say developer
> sets it to true, git can record the SHA. If any latest pull has the
> hooks changed, git can revert the `trusted-hook` to default.
> 
> This way there is not much hassle for developers to manually copy
> hooks all the time. And at the same time, they are not running scripts
> that they haven't reviewed.

We've talked about doing something like this (though more for config
than for hooks). But what the discussion always come down to is that
carrying a script like "import-hooks.sh" in the repository ends up being
the exact same amount of work for the developer as any git-blessed "OK,
trust these hooks" command.

And it's a lot more flexible. The writer of that script can touch hooks,
config, etc. They can base decisions about what values to use based on
data that Git otherwise wouldn't care about (e.g., uname). And they only
have to handle cases that the project cares about, whereas anything Git
does has to work everywhere.

-Peff

  reply	other threads:[~2017-12-16  9:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15 19:12 Git Hooks Satyakiran Duggina
2017-12-15 19:23 ` Bryan Turner
2017-12-15 20:48   ` Satyakiran Duggina
2017-12-16  9:53     ` Jeff King [this message]
2017-12-19 13:55       ` Allowing remote git repos to set config & hook configuration Ævar Arnfjörð Bjarmason
  -- strict thread matches above, loose matches on Subject: below --
2009-09-16 23:24 Git Hooks daicoden
2009-09-16 23:31 ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20171216095357.GB32706@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bturner@atlassian.com \
    --cc=git@vger.kernel.org \
    --cc=satya0521@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).