On 9/10/2018 1:07 PM, Stefan Beller wrote:
On Mon, Sep 10, 2018 at 9:29 AM Ben Peart <benpeart@xxxxxxxxxxxxx> wrote:
It was reported that
GIT_FSMONITOR_TEST=$PWD/t7519/fsmonitor-all ./t7411-submodule-config.sh
breaks as the fsmonitor data is out of sync with the state of the .gitmodules
file. Update is_staging_gitmodules_ok() so that it no longer tells
ie_match_stat() to ignore refreshing the fsmonitor data.
Wondering how this came to be,
7da9aba4178 (submodule: used correct index in is_staging_gitmodules_ok,
2017-12-12) last touched this line, but is unrelated as the fsmonitor
behavior was
there before.
Before that, we have 883e248b8a0 (fsmonitor: teach git to optionally utilize a
file system monitor to speed up detecting new or changed files., 2017-09-22)
that was written by you, who knows the fsmonitor better than I do (or Brandon
who wrote the commit referenced above).
Looking through the archive, it seems that we might have more such hidden
gems?
Fortunately, the only one left is the one in preload_index() which is
what the flag was created to handle so I think we're ok.
https://public-inbox.org/git/f50825a4-fa15-9f28-a079-853e78ee8e2e@xxxxxxxxx/
Anyway, I think this is a better fix than what I proposed for sure.
Thanks for looking into this!
Stefan
Reported-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
Helped-by: Stefan Beller <sbeller@xxxxxxxxxx>
Signed-off-by: Ben Peart <benpeart@xxxxxxxxxxxxx>
---
Notes:
Base Ref: v2.19.0-rc2
Web-Diff: https://github.com/benpeart/git/commit/ed30e1a885
Checkout: git fetch https://github.com/benpeart/git fsmonitor-t7411-v1 && git checkout ed30e1a885
submodule.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/submodule.c b/submodule.c
index 50cbf5f13e..1e7194af28 100644
--- a/submodule.c
+++ b/submodule.c
@@ -65,8 +65,7 @@ int is_staging_gitmodules_ok(struct index_state *istate)
if ((pos >= 0) && (pos < istate->cache_nr)) {
struct stat st;
if (lstat(GITMODULES_FILE, &st) == 0 &&
- ie_match_stat(istate, istate->cache[pos], &st,
- CE_MATCH_IGNORE_FSMONITOR) & DATA_CHANGED)
+ ie_match_stat(istate, istate->cache[pos], &st, 0) & DATA_CHANGED)
return 0;
}
base-commit: c05048d43925ab8edcb36663752c2b4541911231
--
2.18.0.windows.1