It was reported that GIT_FSMONITOR_TEST=$PWD/t7519/fsmonitor-all ./t7411-submodule-config.sh breaks as the .gitmodules file is modified and staged after the fsmonitor considers it clean. Mark the .gitmodules file to be not clean before staging. Reported-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> Inspired-by: Ben Peart <benpeart@xxxxxxxxxxxxx> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- I am not quite sure if this is the correct approach and handling of the fsmonitor API, but it unbreaks the test. > Just naively adding mark_fsmonitor_invalid doesn't work, as then ... Adding it before the staging, works. Please double check! Thanks, Stefan submodule.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/submodule.c b/submodule.c index 50cbf5f13ed..56b0d5fe24e 100644 --- a/submodule.c +++ b/submodule.c @@ -22,6 +22,7 @@ #include "worktree.h" #include "parse-options.h" #include "object-store.h" +#include "fsmonitor.h" static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF; static struct string_list changed_submodule_names = STRING_LIST_INIT_DUP; @@ -149,6 +150,15 @@ int remove_path_from_gitmodules(const char *path) void stage_updated_gitmodules(struct index_state *istate) { + struct cache_entry *ce; + int pos; + + pos = index_name_pos(istate, GITMODULES_FILE, strlen(GITMODULES_FILE)); + ce = (0 <= pos) ? istate->cache[pos] : NULL; + + if (ce) + mark_fsmonitor_invalid(istate, ce); + if (add_file_to_index(istate, GITMODULES_FILE, 0)) die(_("staging updated .gitmodules failed")); } -- 2.19.0.rc2.392.g5ba43deb5a-goog