diff options
| author | Paul Tarjan <github@paulisageek.com> | 2026-02-28 17:37:57 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-02 08:15:18 -0800 |
| commit | 41366e46779865164e3e8af2bac6eb95ea6f6586 (patch) | |
| tree | d4ce4994fef7c35baf0d304a762f2f3deb4ea1dc /contrib/persistent-https | |
| parent | 67ad42147a7acc2af6074753ebd03d904476118f (diff) | |
| download | git-41366e46779865164e3e8af2bac6eb95ea6f6586.tar.gz git-41366e46779865164e3e8af2bac6eb95ea6f6586.zip | |
fsmonitor-watchman: fix variable reference and remove redundant code
The is_work_tree_watched() function in fsmonitor-watchman.sample has
two bugs:
1. Wrong variable in error check: After calling watchman_clock(), the
result is stored in $o, but the code checks $output->{error} instead
of $o->{error}. This means errors from the clock command are silently
ignored.
2. Double output violates protocol: When the retry path triggers (the
directory wasn't initially watched), output_result() is called with
the "/" flag, then launch_watchman() is called recursively which
calls output_result() again. This outputs two clock tokens to stdout,
but git's fsmonitor v2 protocol expects exactly one response.
Fix #1 by checking $o->{error} after watchman_clock().
Fix #2 by removing the recursive launch_watchman() call. The "/"
"everything is dirty" flag already tells git to do a full scan, and
git will call the hook again on the next invocation with a valid clock
token.
With the recursive call removed, the $retry guard is no longer needed
since it only existed to prevent infinite recursion. Remove it.
Apply the same fixes to the test helper scripts in t/t7519/.
Signed-off-by: Paul Tarjan <github@paulisageek.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
