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

Re: [PATCH v2 3/3] hook-list.h: add a generated list of hooks, like config-list.h

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 10, 2021, 09:03 UTC
Message-ID
<87wnpy4jyb.fsf@evledraar.gmail.com>
In-Reply-To
<YOixxZQDVDKIM8bo@google.com>
On Fri, Jul 09 2021, Emily Shaffer wrote:
Show 18 quoted lines
> On Tue, Jun 29, 2021 at 08:54:02PM +0200, Ævar Arnfjörð Bjarmason wrote:
>>  const char *find_hook(const char *name)
>>  {
>>  	static struct strbuf path = STRBUF_INIT;
>>  
>> +	if (!known_hook(name))
>> +		die(_("the hook '%s' is not known to git, should be in hook-list.h via githooks(5)"),
>> +		    name);
>> +
>
> I'm not sure that it's necessary to require this, to be honest. I see a
> use case for wrappers to want to store and run hooks in an idiomatic
> way, and doing so by instructing their users to stick in
> .git/hooks/wrapper-clone (for example) and then calling 'git hook run
> wrapper-clone'. That's doubly compelling in a later config-based-hooks
> world where 'git hook run' gets you free multihook features like
> ordering and parallelism. I will likely want to remove this when
> rebasing my config-based hooks work on top of your restart.

Indeed, FWIW this was part of my general approach of narrowly supporting existing git behavior only with 'git hook run', i.e. there's no general "run this thing like a hook for me" now, so we're not losing anything by not having it support that.

But yes, I can see how "run this script for me as if though it were a hook" would be useful, will be trivial to support it & still somehow assert typos/that hook-list.h / githooks.txt is a source of truth about our known hooks.

Previous: Emily ShafferNext: Emily Shaffer
Message 19 of 21 in “Add a generated list of hooks in hook-list.h”
  1. 0/3 Add a generated list of hooks in hook-list.hÆvar Arnfjörð Bjarmason, Jun 17, 2021
  2. 1/3 hook.[ch]: move find_hook() to this new libraryÆvar Arnfjörð Bjarmason, Jun 17, 2021
  3. 2/3 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Jun 17, 2021
  4. 3/3 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Jun 17, 2021
  5. SZEDER GáborJun 18, 2021
  6. Eric SunshineJun 18, 2021
  7. Junio C HamanoJun 19, 2021
  8. Ævar Arnfjörð BjarmasonJun 20, 2021
  9. René ScharfeJun 20, 2021
  10. Johannes SchindelinJun 22, 2021
  11. Junio C HamanoJun 29, 2021
  12. René ScharfeJun 29, 2021
  13. 0/3 Add a generated list of hooks in hook-list.hÆvar Arnfjörð Bjarmason, Jun 29, 2021
  14. 1/3 hook.[ch]: move find_hook() to this new libraryÆvar Arnfjörð Bjarmason, Jun 29, 2021
  15. 3/3 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Jun 29, 2021
  16. René ScharfeJun 29, 2021
  17. Ævar Arnfjörð BjarmasonJun 29, 2021
  18. Emily ShafferJul 9, 2021
  19. Ævar Arnfjörð BjarmasonJul 10, 2021
  20. Emily ShafferJul 12, 2021
  21. 2/3 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Jun 29, 2021

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.