Subject: [PATCH 0/4] fsmonitor: start using an opaque token for last update

From: "Kevin Willford via GitGitGadget" <[email-masked]>
Date: Tue, 07 Jan 2020 19:04:27 +0000

When using watchman for the fsmonitor there are race conditions when using a
timestamp for the last update as noted in the watchman documentation "Using
a timestamp is prone to race conditions in understanding the complete state
of the file tree." https://facebook.github.io/watchman/docs/clockspec.html

Watchman uses something referred to as a clock id to remove these race
conditions. In order to use a clock id for the last update, an opaque value
needs to be returned by the fsmonitor hook and saved so that it can be
passed back to the fsmonitor hook for the next query. This requires a new
version for the fsmonitor index extension and new versions for the fsmonitor
watchman hooks. We also need to make sure version 1 of the hook continues to
work because users may not update their hook when they update git and we
want things to continue to work on repos still using a version 1 hook.

Kevin Willford (4):
  fsmonitor: change last update timestamp on the index_state to opaque
    token
  fsmonitor: handle version 2 of the hooks that will use opaque token
  fsmonitor: add fsmonitor hook scripts for version 2
  fsmonitor: update documentation for hook version and watchman hooks

 Documentation/config/core.txt              |  11 ++
 Documentation/githooks.txt                 |  13 +-
 cache.h                                    |   2 +-
 fsmonitor.c                                | 120 ++++++++++----
 t/helper/test-dump-fsmonitor.c             |   2 +-
 t/t7519-status-fsmonitor.sh                |   7 +-
 t/t7519/fsmonitor-all                      |   1 -
 t/t7519/fsmonitor-all-v2                   |  21 +++
 t/t7519/fsmonitor-watchman                 |   3 +-
 t/t7519/fsmonitor-watchman-v2              | 173 +++++++++++++++++++++
 templates/hooks--fsmonitor-watchman.sample | 138 ++++++++++------
 11 files changed, 405 insertions(+), 86 deletions(-)
 create mode 100755 t/t7519/fsmonitor-all-v2
 create mode 100755 t/t7519/fsmonitor-watchman-v2

base-commit: 0a76bd7381ec0dbb7c43776eb6d1ac906bca29e6
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-510%2Fkewillford%2Ffsmonitor_opaque_token-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-510/kewillford/fsmonitor_opaque_token-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/510
-- 
gitgitgadget