diff mbox series

[v9,36/37] doc: clarify fsmonitor-watchman specification

Message ID 20210527000856.695702-37-emilyshaffer@google.com (mailing list archive)
State New, archived
Headers show
Series propose config-based hooks | expand

Commit Message

Emily Shaffer May 27, 2021, 12:08 a.m. UTC
fsmonitor-watchman is not specified in the same way that other hooks
are. In fsmonitor.c:query_fsmonitor(), the path stored in
'core_fsmonitor' is executed directly via
run-command.h:capture_command(). 'core_fsmonitor' is set during 'git
update-index' via config.c:git_config_get_fsmonitor(). Neither
builtin/update-index.c, nor config.c, nor fsmonitor.c check  that the
path given is in '.git/hooks'.

None of the existing hook execution code is used by fsmonitor.c to
invoke fsmonitor-watchman, because that executable isn't expected to
reside in '.git/hooks'.

Furthermore, it doesn't make sense to specify the fsmonitor-watchman
hook more than once, and that hook itself may soon be superseded by
native logic to talk to an fsmonitor daemon directly from the Git
executable. (See <e019cc71-ac39-44a4-0a23-b3b7decec754@jeffhostetler.com>
for more information.)

Therefore, let's correct the user-facing documentation around
fsmonitor-watchman and clarify that it won't be supported by
config-based hooks.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
 Documentation/githooks.txt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 78cc4e0872..42e66d4e2d 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -649,9 +649,12 @@  e-mails.
 fsmonitor-watchman
 ~~~~~~~~~~~~~~~~~~
 
-This hook is invoked when the configuration option `core.fsmonitor` is
-set to `.git/hooks/fsmonitor-watchman` or `.git/hooks/fsmonitor-watchmanv2`
-depending on the version of the hook to use.
+This hook is invoked when the configuration option `core.fsmonitor` is set to a
+path containing an executable. It *cannot* be specified via the usual
+`hook.fsmonitor-watchman.command` configuration or by providing an executable
+in `.git/hooks/fsmonitor-watchman`. The arguments provided to the hook are
+determined by the value of the `core.fsmonitorHookVersion` configuration
+option.
 
 Version 1 takes two arguments, a version (1) and the time in elapsed
 nanoseconds since midnight, January 1, 1970.