From: "John P. Hartmann" <jphartmann@gmail.com>
To: Jeff King <peff@peff.net>, Jacob Keller <jacob.keller@gmail.com>
Cc: Git mailing list <git@vger.kernel.org>
Subject: Re: HowTo distribute a hook with the reposity.
Date: Wed, 28 Dec 2016 08:42:25 +0000 [thread overview]
Message-ID: <6801f971-418d-18c9-8002-9c2f7b8c8008@gmail.com> (raw)
In-Reply-To: <20161228060840.gelgcs2hd33id56j@sigill.intra.peff.net>
Thanks; your point is taken. One final wrinkle:
This project is hosted on github. If I put the hook into the repository
manually (if I can; I don't know that), is it true that the hook would
be distributed on a clone action, but not on a pull?
j.
On 28/12/16 06:08, Jeff King wrote:
> On Tue, Dec 27, 2016 at 09:32:22PM -0800, Jacob Keller wrote:
>
>> On Tue, Dec 27, 2016 at 5:34 PM, John P. Hartmann <jphartmann@gmail.com> wrote:
>>> I would like a hook in .got/hooks to be made available to all who clone or
>>> pull a particular project. I'd also like the hook to be under git control
>>> (changes committed &c). I added a hook, but git status does not show it.
>>> Presumably git excludes its files in .git/ from version control lest there
>>> be a chiken-and-egg situation.
>>>
>>> Is there a way to achieve this? Or a better way to do it?
>>>
>>> Thanks, j.
>>
>> Best way I found, was add a script with an "installme" shell script or
>> similar that you tell all users of the repository that they are
>> expected to run this to install the scripts. You can' make it happen
>> automatically.
>
> I agree that is the best way to do it.
>
> I didn't dig up previous discussions, but the gist is usually:
>
> 1. Cloning a repository should not run arbitrary code from the remote
> without the user on the cloning side taking some further affirmative
> action.
>
> This is for security reasons. Obviously the next step is quite often
> to run "make" which does run arbitrary code, but that counts as an
> action.
>
> 2. We could write a feature in git that manages hooks (or config, etc).
> But ultimately you would still be running "git clone
> --trust-remote-hooks" or something to satisfy point (1).
>
> 3. There's not much point in doing point (2), because you can just
> spell it as "git clone && cd clone && ./install-hooks" and then git
> does not have to care at all about your scripts.
>
> 4. A hook (or config) management system could do fancy things like
> merging your custom local config, picking up changes from the
> remote, etc. But all of that can happen outside of Git totally (and
> quite often you want to manage things in contributors setups
> _besides_ Git data anyway).
>
> An example system is:
>
> https://github.com/Autodesk/enterprise-config-for-git
>
> (with the disclaimer that I've never used it myself, so I have no
> idea how good it is).
>
> I think you probably know all that, Jake, but I am laying it out for the
> benefit of the OP and the list. :)
>
> -Peff
>
next prev parent reply other threads:[~2016-12-28 8:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 1:34 HowTo distribute a hook with the reposity John P. Hartmann
2016-12-28 5:32 ` Jacob Keller
2016-12-28 6:08 ` Jeff King
2016-12-28 8:42 ` John P. Hartmann [this message]
2016-12-28 8:52 ` Jeff King
2016-12-28 9:09 ` John P. Hartmann
2016-12-28 9:20 ` Jeff King
2016-12-28 18:53 ` Jacob Keller
2016-12-29 10:29 ` Lars Schneider
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=6801f971-418d-18c9-8002-9c2f7b8c8008@gmail.com \
--to=jphartmann@gmail.com \
--cc=git@vger.kernel.org \
--cc=jacob.keller@gmail.com \
--cc=peff@peff.net \
/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 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).