Expand description
Every real-Git start of the wrapper carries core.hooksPath pointing at a directory that never exists.
What:
Start the real Git with traditional hooks switched off.
Why:
Traditional hooks (executable files in <git-common-dir>/hooks or a core.hooksPath directory) are unsupported,
and git lfs writes its four shims there again whenever it cleans a file, so a hook file must never run
because of a start the wrapper made.
Every real-Git start of the wrapper therefore carries -c core.hooksPath=<a directory that never exists> ahead of
its arguments: Git then finds no hook file, while hooks defined in the configuration
(hook.<name>.event with hook.<name>.command) still run.
A -c core.hooksPath=... the caller writes comes later on the command line, so it wins.
The option is part of the argument vector, so it adds no system call and no process start.
In TS you’d write (pseudocode):
spawn(realGit, ['-c', `core.hooksPath=${NO_HOOKS_DIRECTORY}`, ...args]);Constants§
- NO_
HOOKS_ DIRECTORY - The
core.hooksPathvalue of every start: below/dev/null, which is a device, so nothing can create it.
Functions§
- activate
- What: Switch the hooks-off option on for every real-Git start this process makes from now on. Why: The executable’s entry calls it first, so no production start misses it. The library’s unit controls, which fake Git with scripts that record the exact arguments they receive, leave it off, and the binary-level controls prove the option on the built executable.
- add_
hooks_ off_ option - What:
Add the hooks-off option to a command, unless it is a configuration query.
Why:
The option goes before the arguments the command already carries or is about to carry, so a
-c core.hooksPathof the caller comes later and wins. - disable_
traditional_ hooks - What: Put the hooks-off option in front of a real-Git command’s arguments once the process has switched it on. Why: One function serves both builders of real-Git commands, so no start can miss it.