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

Re: Feature request: hooks directory

From
WSWesley Schwengle <wesley@mintlab.nl>
Date
Aug 31, 2018, 12:38 UTC
Message-ID
<CAEpdsiZFMphQTdJnqFYH03M80W8CcrCbr2Uewktm0jy4D+Fz1A@mail.gmail.com>
In-Reply-To
<87pnxzdib7.fsf@evledraar.gmail.com>
Hop,
2018-08-30 16:45 GMT+02:00 Ævar Arnfjörð Bjarmason <avarab@gmail.com>:
Show 16 quoted lines
>> Solution:
>> We discussed this at work and we thought about making a .d directory
>> for the hooks, eg.  $GIT_DIR/hooks/post-commit.d, where a user can put
>> the post-commit hooks in. This allows us to provide post commit hooks
>> and allows the user to add additional hooks him/herself. We could
>> implement this in our own code base. But we were wondering if this
>> approach could be shared with the git community and if this behavior
>> is wanted in git itself.
>
> There is interest in this. This E-Mail of mine gives a good summary of
> prior discussions about this:
> https://public-inbox.org/git/877eqqnq22.fsf@evledraar.gmail.com/
>
> I.e. it's something I've personally been interested in doing in the
> past, there's various bolt-on solutions to do it (basically local hook
> runners) used by various projects.

Thank you for the input. Do you by any chance still have that branch? Or would you advise me to start fresh, if so, do you have any pointers on where to look as I'm brand new to the git source code?

From the thread I've extracted three stories:
1) As a developer I want to have 'hooks.multiHooks' to enable
multi-hook support in git
Input is welcome for another name.
2) As a developer I want natural sort order executing for my githooks
so I can predict executions
See https://public-inbox.org/git/CACBZZX6AYBYeb5S4nEBhYbx1r=icJ81JGYBx5=H4wacPhHjFbQ@mail.gmail.com/
for more information
3) As a developer I want to run $GIT_DIR/hooks/<hook> before
$GIT_DIR/hooks/<hook>.d/*
Reference: https://public-inbox.org/git/CACBZZX6j6q2DUN_Z-Pnent1u714dVNPFBrL_PiEQyLmCzLUVxg@mail.gmail.com/
The following story would be.. nice to have I think. I'm not sure I
would want to implement this from the get go as I don't have a use
case for it.
4) As a developer I want a way to have a hook report an error and let
another hook decide if we want to pass or not.
Reference: https://public-inbox.org/git/xmqq60v4don1.fsf@gitster.mtv.corp.google.com/
2018-08-31 5:16 GMT+02:00 Jonathan Nieder <jrnieder@gmail.com>:
Show 8 quoted lines
> A few unrelated thoughts, to expand on this.
>
> Separately from that, in [1] I mentioned that I want to revamp how
> hooks work somewhat, to avoid the attack described there (or the more
> common attack also described there that involves a zip file).  Such a
> revamp would be likely to also handle this multiple-hook use case.
>
> [1] https://public-inbox.org/git/20171002234517.GV19555@aiede.mtv.corp.google.com/

The zip file attack vector doesn't change with adding a hook.d directory structure? If I have one file or multiple files, the attack stays the same? I think I'm asking if this would be a show stopper for the feature.

Cheers, Wesley

-- 
Wesley Schwengle, Developer
Mintlab B.V., https://www.zaaksysteem.nl
E: wesley@mintlab.nl
T:  +31 20 737 00 05
Previous: Jonathan NiederNext: Ævar Arnfjörð Bjarmason
Message 4 of 8 in “Feature request: hooks directory”
  1. Wesley SchwengleAug 30, 2018
  2. Ævar Arnfjörð BjarmasonAug 30, 2018
  3. Jonathan NiederAug 31, 2018
  4. Wesley SchwengleAug 31, 2018
  5. Ævar Arnfjörð BjarmasonAug 31, 2018
  6. Wesley SchwengleSep 2, 2018
  7. Christian CouderSep 3, 2018
  8. Wesley SchwengleSep 3, 2018

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.