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

Re: [PATCH v2] hooks: propose project configured hooks

From
Albert Cui <albertqcui@gmail.com>
Date
Apr 5, 2021, 23:40 UTC
Message-ID
<CAMbkP-SBQMLeM14d9KSnzE44KsfhHPsxWQ1PaskauWPynTJvWQ@mail.gmail.com>
In-Reply-To
<xmqqmtuc49cm.fsf@gitster.g>
On Mon, Apr 5, 2021 at 4:09 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 36 quoted lines
>
> Albert Cui <albertqcui@gmail.com> writes:
>
> >> Requirements like these make me think that these repositories would be
> >> better off with a script that configures the hooks after checking if
> >> these things actually exist on the PATH (and installs them if not). I
> >> would lower the priority of this one for now.
> >>
> >
> > As mentioned, for enterprise deployments, this can be solved by administrators
> > installing any necessary software automatically.
> >
> > Otherwise, I think ensuring the tool is installed feels out-of-scope
> > (as written in
> > the doc); it's not like Git makes sure compilers or build tools are
> > installed today,
> > and even today, users could set up Husky hooks that rely on $PATH tools, so
> > we're not introducing a new problem.
>
> I am afraid that this compares apples and oranges.
>
> I may "git clone" and try "make" to find out that I needed a special
> compiler, and that would not be the end of the world.  It is
> guaranteed that "git clean -f -x -d" followed by installation of
> necessary toolchain followed by "make" would work.  And that is
> partly because "git clone" does not do any more than just clone and
> checkout the initial tree.
>
> If a new version of "git clone" told me "I can install the project
> recommended hooks to use", I answer "yes", and then failed while
> installing and configuring the project-recommended hooks because of
> missing dependencies, then I wouldn't know in what state the result
> would be in.  In some projects, it may be enough to just install the
> missing dependencies, and in some others, it may not be enough and I
> have a broken half-configured mess depending on how the "installing
> and configuring" step failed.

I'm a little confused, and maybe it's because we have different definitions of what "installing hooks" means. By installing hooks, I meant the addition of the hook command to the config, e.g the outcome of:

`git config --add hook.pre-commit.command pylint`

This works today; Git won't complain if I don't have pylint installed, so I don't see how we'd get into a "broken half-configured mess."

It will complain when it tries to execute the hook, and this is where I see it as the same as the 'I may "git clone" and try "make" to find out that I needed a special compiler, and that would not be the end of the world' case.

Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 39 in “hooks: propose repository owner configured hooks”
  1. hooks: propose repository owner configured hooksAlbert Cui via GitGitGadget, Mar 18, 2021
  2. Junio C HamanoMar 18, 2021
  3. Albert CuiMar 18, 2021
  4. brian m. carlsonMar 19, 2021
  5. Ævar Arnfjörð BjarmasonMar 19, 2021
  6. Albert CuiApr 6, 2021
  7. Ævar Arnfjörð BjarmasonApr 7, 2021
  8. Jonathan TanJun 21, 2021
  9. Ævar Arnfjörð BjarmasonJun 21, 2021
  10. hooks: propose project configured hooksAlbert Cui via GitGitGadget, Mar 26, 2021
  11. Emily ShafferMar 29, 2021
  12. Albert CuiApr 1, 2021
  13. Derrick StoleeMar 30, 2021
  14. Albert CuiApr 5, 2021
  15. Junio C HamanoApr 5, 2021
  16. Albert CuiApr 5, 2021
  17. Junio C HamanoApr 6, 2021
  18. Albert CuiApr 6, 2021
  19. brian m. carlsonApr 6, 2021
  20. Ævar Arnfjörð BjarmasonApr 7, 2021
  21. Derrick StoleeApr 7, 2021
  22. Albert CuiApr 7, 2021
  23. Junio C HamanoApr 7, 2021
  24. Ævar Arnfjörð BjarmasonApr 7, 2021
  25. Ed MasteApr 15, 2021
  26. Junio C HamanoApr 15, 2021
  27. Ed MasteApr 15, 2021
  28. Junio C HamanoApr 15, 2021
  29. brian m. carlsonApr 15, 2021
  30. Ævar Arnfjörð BjarmasonApr 2, 2021
  31. Albert CuiApr 5, 2021
  32. Ævar Arnfjörð BjarmasonApr 2, 2021
  33. Albert CuiApr 3, 2021
  34. hooks: propose project configured hooksAlbert Cui via GitGitGadget, Apr 24, 2021
  35. Junio C HamanoApr 28, 2021
  36. hooks: propose project configured hooksAlbert Cui via GitGitGadget, May 5, 2021
  37. Jonathan TanJun 3, 2021
  38. Albert CuiJun 3, 2021
  39. Jonathan TanJun 3, 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.