On August 24, 2021 4:12 PM, Ævar Arnfjörð Bjarmason wrote: >On Wed, Aug 18 2021, Emily Shaffer wrote: > >> Since hooks can now be supplied via the config, and a config can be >> present without a gitdir via the global and system configs, we can >> start to allow 'git hook run' to occur without a gitdir. This enables >> us to do things like run sendemail-validate hooks when running 'git send-email' >> from a nongit directory. > >Sensible goal. Perhaps we should note in an earlier commit when config-based hooks are introduced something like: To clarify the requirements here, if running without a gitdir (and thus without a repository?) how will front-ends know what to supply? Will this just be "some shell script" that runs? > > Even though we've added config-based hooks, they currently only work > if we can find a .git directory, even though certain commands such > as "git send-email" (or only that command?) can be run outside of a > git directory. A subsequent commit will address that edge-case. So we cannot assume anything about the repository, correct? Similar to running git version but not git status? >> [...] >> Notes: >> For hookdir hooks, do we want to run them in nongit dir when core.hooksPath >> is set? For example, if someone set core.hooksPath in their global config and >> then ran 'git hook run sendemail-validate' in a nongit dir? So this is complete consent to run outside of git? I wonder whether there needs to be an attribute associated with the hook that enables this edge capability. That way we can validate whether the hook should be run or not (from front-end scripts).