git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/2] Fix fsmonitor after discard_index()

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 21, 2019, 13:57 UTC
Message-ID
<pull.165.v2.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.165.git.gitgitgadget@gmail.com>

It was reported by Ævar Arnfjörð Bjarmason [https://public-inbox.org/git/nycvar.QRO.7.76.6.1903142058130.41@tvgsbejvaqbjf.bet/T/#mb8718fe52e4721dacd3b143a09187ff9090ef4e3] that there were problems with the fsmonitor feature in conjunction with the newly built-in git stash/git rebase.

The culprit really is that the fsmonitor flag that says whether it was queried already was not re-set after discard_index() was called by mistake.

This fixes that, and apparently also other long-standing fsmonitor issues.

(Note that there is still a flakiness around t7519 [https://github.com/git-for-windows/git/pull/2127#pullrequestreview-215010574] where it tries to make sure that the fsmonitor hook can prevent unnecessary lstat() calls, but that seems to be unrelated to this here bug.)

Changes since v1:
 * Removed unnecessary test_when_finished "test_config ..." line, pointed
   out by Hannes Sixt.
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(-)
base-commit: 041f5ea1cf987a4068ef5f39ba0a09be85952064
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-165%2Fdscho%2Ffix-fsmonitor-after-discard-index-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-165/dscho/fix-fsmonitor-after-discard-index-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/165
Range-diff vs v1:
 1:  f451752656 ! 1:  51a7edf22a fsmonitor: demonstrate that it is not refreshed after discard_index()
     @@ -79,8 +79,6 @@
       '
       
      +test_expect_failure 'discard_index() also discards fsmonitor info' '
     -+	test_when_finished \
     -+		"git config core.monitor .git/hooks/fsmonitor-test" &&
      +	test_config core.fsmonitor "$TEST_DIRECTORY/t7519/fsmonitor-all" &&
      +	test_might_fail git update-index --refresh &&
      +	test-tool read-cache --print-and-refresh=tracked 2 >actual &&
 2:  1d62623776 ! 2:  79fdd0d586 fsmonitor: force a refresh after the index was discarded
     @@ -70,6 +70,6 @@
       
      -test_expect_failure 'discard_index() also discards fsmonitor info' '
      +test_expect_success 'discard_index() also discards fsmonitor info' '
     - 	test_when_finished \
     - 		"git config core.monitor .git/hooks/fsmonitor-test" &&
       	test_config core.fsmonitor "$TEST_DIRECTORY/t7519/fsmonitor-all" &&
     + 	test_might_fail git update-index --refresh &&
     + 	test-tool read-cache --print-and-refresh=tracked 2 >actual &&
-- 
gitgitgadget
Previous: Johannes SchindelinNext: Johannes Schindelin via GitGitGadget
Message 9 of 17 in “Fix fsmonitor after discard_index()”
  1. 0/2 Fix fsmonitor after discard_index()Johannes Schindelin via GitGitGadget, Mar 16, 2019
  2. 1/2 fsmonitor: demonstrate that it is not refreshed after discard_index()Johannes Schindelin via GitGitGadget, Mar 16, 2019
  3. Johannes SixtMar 16, 2019
  4. Johannes SchindelinMar 21, 2019
  5. 2/2 fsmonitor: force a refresh after the index was discardedJohannes Schindelin via GitGitGadget, Mar 16, 2019
  6. Ævar Arnfjörð BjarmasonMar 18, 2019
  7. Johannes SchindelinMar 21, 2019
  8. Johannes SchindelinMay 23, 2019
  9. 0/2 Fix fsmonitor after discard_index()Johannes Schindelin via GitGitGadget, Mar 21, 2019
  10. 1/2 fsmonitor: demonstrate that it is not refreshed after discard_index()Johannes Schindelin via GitGitGadget, Mar 21, 2019
  11. 2/2 fsmonitor: force a refresh after the index was discardedJohannes Schindelin via GitGitGadget, Mar 21, 2019
  12. SZEDER GáborMar 22, 2019
  13. 0/2 Fix fsmonitor after discard_index()Ævar Arnfjörð Bjarmason, May 7, 2019
  14. Junio C HamanoMay 7, 2019
  15. Junio C HamanoMay 8, 2019
  16. 1/2 fsmonitor: demonstrate that it is not refreshed after discard_index()Ævar Arnfjörð Bjarmason, May 7, 2019
  17. 2/2 fsmonitor: force a refresh after the index was discardedÆvar Arnfjörð Bjarmason, May 7, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.