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

From: Junio C Hamano <[email-masked]>
Date: Mon, 05 Apr 2021 16:09:29 -0700

Albert Cui <[email-masked]> 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.