Skip to content

Commit 1db2a69

Browse files
committed
fsmonitor: update documentation for hook version and watchman hooks
A new config value for core.fsmonitorHookVersion was added to be able to force the version of the fsmonitor hook. Possible values are 1 or 2. When this is not set the code will use a value of -1 and attempt to use version 2 of the hook first and if that fails will attempt version 1. Signed-off-by: Kevin Willford <[email protected]>
1 parent ecc288c commit 1db2a69

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Documentation/config/core.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ core.fsmonitor::
6868
avoiding unnecessary processing of files that have not changed.
6969
See the "fsmonitor-watchman" section of linkgit:githooks[5].
7070

71+
core.fsmonitorHookVersion::
72+
Sets the version of hook that is to be used when calling fsmonitor.
73+
There are currently versions 1 and 2. When this is not set,
74+
version 2 will be tried first and if it fails then version 1
75+
will be tried. Version 1 uses a timestamp as input to determine
76+
which files have changes since that time but some monitors
77+
like watchman have race conditions when used with a timestamp.
78+
Version 2 uses an opaque string so that the monitor can return
79+
something that can be used to determine what files have changed
80+
without race conditions.
81+
7182
core.trustctime::
7283
If false, the ctime differences between the index and the
7384
working tree are ignored; useful when the inode change time

Documentation/githooks.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,16 @@ fsmonitor-watchman
490490
~~~~~~~~~~~~~~~~~~
491491

492492
This hook is invoked when the configuration option `core.fsmonitor` is
493-
set to `.git/hooks/fsmonitor-watchman`. It takes two arguments, a version
494-
(currently 1) and the time in elapsed nanoseconds since midnight,
495-
January 1, 1970.
493+
set to `.git/hooks/fsmonitor-watchman` or `.git/hooks/fsmonitor-watchmanv2`
494+
depending on the version of the hook to use.
495+
496+
Version 1 takes two arguments, a version (1) and the time in elapsed
497+
nanoseconds since midnight, January 1, 1970.
498+
499+
Version 2 takes two arguments, a version (2) and a token that is used
500+
for identifying changes since the token. For watchman this would be
501+
a clock id. This version must output to stdout the new token followed
502+
by a NUL before the list of files.
496503

497504
The hook should output to stdout the list of all files in the working
498505
directory that may have changed since the requested time. The logic

0 commit comments

Comments
 (0)