On Mon, Apr 5, 2021 at 4:09 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Albert Cui <albertqcui@xxxxxxxxx> 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.