Merge branch 'jc/diff-cached-fsmonitor-fix'

The optimization based on fsmonitor in the "diff --cached"
codepath is resurrected with the "fake-lstat" introduced earlier.

* jc/diff-cached-fsmonitor-fix:
  diff-lib: fix check_removed() when fsmonitor is active
This commit is contained in:
Junio C Hamano
2023-12-27 14:52:25 -08:00

View File

@ -38,7 +38,13 @@
*/
static int check_removed(const struct cache_entry *ce, struct stat *st)
{
if (lstat(ce->name, st) < 0) {
int stat_err;
if (!(ce->ce_flags & CE_FSMONITOR_VALID))
stat_err = lstat(ce->name, st);
else
stat_err = fake_lstat(ce, st);
if (stat_err < 0) {
if (!is_missing_file_error(errno))
return -1;
return 1;