Skip to content

Commit

Permalink
Merge branch 'jc/diff-cached-fsmonitor-fix' into next
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Dec 15, 2023
2 parents 48e34cc + 811c9c2 commit 4aa7596
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion diff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4aa7596

Please sign in to comment.