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

Re: RFC: Supporting .git/hooks/$NAME.d/* && /etc/git/hooks/$NAME.d/*

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 26, 2016, 21:52 UTC
Message-ID
<xmqq60v4don1.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CACBZZX6AYBYeb5S4nEBhYbx1r=icJ81JGYBx5=H4wacPhHjFbQ@mail.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 22 quoted lines
> I think it's fair enough to say that if we had this facility this
> would be good enough:
>
>  * Your hooks are executed in glob() order, local .git first, then /etc/git/...
>
>  * If it's a hook like pre-commit that can reject something the first
> hook to fail short-circuits. I.e. none of the rest get executed.
>
>  * If it's not a hook like that e.g. post-commit all of the hooks will
> get executed.
>
>  * If you need anything more complex you can just wrap your hooks in
> your own shellscript.
>
> I.e. it takes care of the common case where:
>
>  * You just want to execute N hooks and don't want to write a wrapper.
>
>  * For pre-* hooks the common case is it doesn't matter /what/
> rejected things, just that it gets rejected, e.g. for pre-receive.
> Also if you care about performance you can order them in
> cheapest-first order.

Stop using the word "common" to describe what is not demonstratably "common".

The above only covers a very limited subset of the use cases, which is the two bullet points above (one of them i.e. "I do not bother to write a wrapper" is not even a valid use case). That may be a good starting point, but it is so simple that can be done with a wrapper with several lines at most. So I am not sympathetic to that line of reasoning at all.

I can buy "It is too cumbersome to require everybody to reinvent and script the cascading logic, and the core side should help by giving a standard interface that is flexible enough to suit people's need", though.

And I have to say that a sequential execution that always short-circuits at the first failure is below that threshold.

One reason I care about allowing the users to specify "do not shortcut" is that I anticipate that people would want to have a logging of the result at the end of the chain.

Previous: Marc Branchaud
Message 8 of 8 in “RFC: Supporting .git/hooks/$NAME.d/* && /etc/git/hooks/$NAME.d/*”
  1. Ævar Arnfjörð BjarmasonApr 22, 2016
  2. Junio C HamanoApr 25, 2016
  3. Ævar Arnfjörð BjarmasonApr 26, 2016
  4. Marc BranchaudApr 26, 2016
  5. Ævar Arnfjörð BjarmasonApr 26, 2016
  6. Christian CouderApr 26, 2016
  7. Marc BranchaudApr 26, 2016
  8. Junio C HamanoApr 26, 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.