run-command: invalidate lstat cache after a command finished
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 2 Feb 2021 21:09:52 +0000 (22:09 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 12 Feb 2021 14:47:02 +0000 (15:47 +0100)
commit0d58fef58a6f382ba1d35f47a01cb55d8976335f
tree17f9a12a0f37445a0b1bfa4e88edfb768566b4b1
parent684dd4c2b414bcf648505e74498a608f28de4592
run-command: invalidate lstat cache after a command finished

In the previous commit, we intercepted calls to `rmdir()` to invalidate
the lstat cache in the successful case, so that the lstat cache could
not have the idea that a directory exists where there is none.

The same situation can arise, of course, when a separate process is
spawned (most notably, this is the case in `submodule_move_head()`).
Obviously, we cannot know whether a directory was removed in that
process, therefore we must invalidate the lstat cache afterwards.

Note: in contrast to `lstat_cache_aware_rmdir()`, we invalidate the
lstat cache even in case of an error: the process might have removed a
directory and still have failed afterwards.

Co-authored-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
run-command.c
t/t0021-conversion.sh