]> git.ipfire.org Git - thirdparty/git.git/commit - fsmonitor.c
fsmonitor: handle version 2 of the hooks that will use opaque token
authorKevin Willford <Kevin.Willford@microsoft.com>
Tue, 7 Jan 2020 19:04:29 +0000 (19:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Jan 2020 22:58:43 +0000 (14:58 -0800)
commit8da2c57629a16e148b0f94282ac787c1503e4779
tree7b425da1398d08acd6c36e8a38d5e24cf999196e
parent56c6910028a0468761b0cd9ee5c0946ce637b586
fsmonitor: handle version 2 of the hooks that will use opaque token

Some file monitors like watchman will use something other than a timestamp
to keep better track of what changes happen in between calls to query
the fsmonitor. The clockid in watchman is a string. Now that the index
is storing an opaque token for the last update the code needs to be
updated to pass that opaque token to a verion 2 of the fsmonitor hook.

Because there are repos that already have version 1 of the hook and we
want them to continue to work when git is updated, we need to handle
both version 1 and version 2 of the hook. In order to do that a
config value is being added core.fsmonitorHookVersion to force what
version of the hook should be used.  When this is not set it will default
to -1 and then the code will attempt to call version 2 of the hook first.
If that fails it will fallback to trying version 1.

Signed-off-by: Kevin Willford <Kevin.Willford@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsmonitor.c
t/t7519-status-fsmonitor.sh
t/t7519/fsmonitor-all
t/t7519/fsmonitor-watchman