]> git.ipfire.org Git - thirdparty/git.git/commit
diff-lib: fix check_removed when fsmonitor is on
authorJosip Sokcevic <sokcevic@google.com>
Mon, 11 Sep 2023 17:09:02 +0000 (10:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Sep 2023 23:45:49 +0000 (16:45 -0700)
commit6a044a20480a8ef56f7ddb8142f660ca01a3391e
tree96fe2189e2f5d09e251ebd52db0ff0219eb18d55
parentd27ae36bbb7512474f759ac61a0581b6bbb36b2f
diff-lib: fix check_removed when fsmonitor is on

`git diff-index` may return incorrect deleted entries when fsmonitor
is used in a repository with git submodules. This can be observed on
Mac machines, but it can affect all other supported platforms too.

If fsmonitor is used, `stat *st` is not initialized if cache_entry has
CE_FSMONITOR_VALID set. But, there are three call sites that rely on stat
afterwards, which can result in incorrect results.

This change partially reverts commit 4f3d6d02 (fsmonitor: skip lstat
deletion check during git diff-index, 2021-03-17).

Signed-off-by: Josip Sokcevic <sokcevic@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-lib.c
t/t7527-builtin-fsmonitor.sh