git/templates
Son Luong Ngoc 134047b500 fsmonitor: query watchman with right valid json
In rare circumstances where the current git index does not carry the
last_update_token, the fsmonitor v2 hook will be invoked with an
empty string which would caused the final rendered json to be invalid.

  ["query", "/path/to/my/git/repository/", {
          "since": ,
          "fields": ["name"],
          "expression": ["not", ["dirname", ".git"]]
  }]

Which will left user with the following error message

  > git status
  failed to parse command from stdin: line 2, column 13, position 67: unexpected token near ','
  Watchman: command returned no output.
  Falling back to scanning...

Hide the "since" field in json query when "last_update_token" is empty.

Co-authored-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Son Luong Ngoc <sluongng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-07 10:00:49 -07:00
..
.gitignore
branches--
hooks--applypatch-msg.sample *.sh: avoid hardcoding $GIT_DIR/hooks/... 2014-12-01 11:00:13 -08:00
hooks--commit-msg.sample Modernize git calling conventions in hook templates 2010-03-20 09:04:38 -07:00
hooks--fsmonitor-watchman.sample fsmonitor: query watchman with right valid json 2022-06-07 10:00:49 -07:00
hooks--post-update.sample Modernize git calling conventions in hook templates 2010-03-20 09:04:38 -07:00
hooks--pre-applypatch.sample *.sh: avoid hardcoding $GIT_DIR/hooks/... 2014-12-01 11:00:13 -08:00
hooks--pre-commit.sample templates: fix deprecated type option --bool 2020-01-21 14:11:20 -08:00
hooks--pre-merge-commit.sample git-merge: honor pre-merge-commit hook 2019-08-07 12:37:33 -07:00
hooks--pre-push.sample hooks--pre-push.sample: use hash-agnostic zero OID 2020-09-23 09:31:45 -07:00
hooks--pre-rebase.sample treewide: correct several "up-to-date" to "up to date" 2017-08-23 12:17:22 -07:00
hooks--pre-receive.sample pre-receive.sample: mark it executable 2016-10-28 14:21:11 -07:00
hooks--prepare-commit-msg.sample hook: use correct logical variable 2017-08-14 11:19:50 -07:00
hooks--push-to-checkout.sample hook: add sample template for push-to-checkout 2020-10-16 08:47:02 -07:00
hooks--update.sample hooks--update.sample: use hash-agnostic zero OID 2020-09-23 09:31:45 -07:00
info--exclude Modernize git calling conventions in hook templates 2010-03-20 09:04:38 -07:00
Makefile Makefile: add "$(QUIET)" boilerplate to shared.mak 2022-03-03 14:14:55 -08:00
this--description