Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-12-28 01:52:25 +0300
committerJunio C Hamano <gitster@pobox.com>2023-12-28 01:52:25 +0300
commitb7fbd2ab83a9c1152eb887ec49c02a71190058ec (patch)
treee29dbb3cd3841cc1dc25d16ed9a3f4c98c2d8890 /diff-lib.c
parent01f86ebb95cc6613db3e637aaba1599e6435c6b7 (diff)
parent811c9c210265a16514fd1b5a513d4b028d711410 (diff)
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
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 0e9ec4f68a..92aa13789d 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -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;