Skip to content

Fix fsmonitor after discard_index()

Ævar Arnfjörð Bjarmason git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest2 patches 2 repliesIn review

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fsmonitor: demonstrate that it is not refreshed after discard_index()t/helper/test-read-cache.c t/t7519-status-fsmonitor.sh+31 -10 replies
2/2fsmonitor: force a refresh after the index was discardedcache.h fsmonitor.c read-cache.c +1 more+6 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] Fix fsmonitor after discard_index()

This v3 is all Johannes's patches. The outstanding review on v2 could be clarified with a commit message change, which I've addressed, and v2 conflicted with a cache.h change that's since landed in "master", which I've rebased this on.

Junio: We're getting closer to the release so it would be great to have this. It's been broken for a long time, but having this finaly fixed in v2.22 would be great. The functional code changes are also isolated to the fsmonitor code path, which reduces the risk and makes this easier to review/reason about.

Johannes Schindelin (2):
fsmonitor: demonstrate that it is not refreshed after discard_index()
fsmonitor: force a refresh after the index was discarded

 cache.h                     |  3 ++-
 fsmonitor.c                 |  5 ++---
 read-cache.c                |  1 +
 t/helper/test-read-cache.c  | 24 +++++++++++++++++++++++-
 t/t7519-status-fsmonitor.sh |  8 ++++++++
 5 files changed, 36 insertions(+), 5 deletions(-)

Range-diff:

1:  51a7edf22a = 1:  c31f834b07 fsmonitor: demonstrate that it is not refreshed after discard_index()
2:  79fdd0d586 ! 2:  7bf5f9f610 fsmonitor: force a refresh after the index was discarded

@@ -6,8 +6,10 @@
flag that says whether the fsmonitor hook has been run, i.e. it is now per-index.

- It also gets re-set when the index is discarded, fixing the bug where
- fsmonitor-enabled Git would miss updates under certain circumstances.
+ It also gets re-set when the index is discarded, fixing the bug
+ demonstrated by the "test_expect_failure" test added in the preceding
+ commit. In that case fsmonitor-enabled Git would miss updates under
+ certain circumstances, see that preceding commit for details.

@@ -15,11 +17,11 @@
--- a/cache.h
+++ b/cache.h
@@
- struct cache_time timestamp;
- unsigned name_hash_initialized : 1,
initialized : 1,
-- drop_cache_tree : 1;
-+ drop_cache_tree : 1,
+ drop_cache_tree : 1,
+ updated_workdir : 1,
+- updated_skipworktree : 1;
++ updated_skipworktree : 1,
+ fsmonitor_has_run_once : 1;
struct hashmap name_hash;
struct hashmap dir_hash;

Signature · 1 line
2.21.0.593.g511ec345e18