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-09-15 00:46:46 +0300
committerJunio C Hamano <gitster@pobox.com>2023-09-16 03:08:46 +0300
commitc33fa871a5c89091cfc89fd7b6ef504d2d48bef2 (patch)
treed8eefcf40275cd2453b3ec5a34685f28627dd095 /statinfo.h
parent43c8a30d150ecede9709c1f2527c8fba92c65f40 (diff)
cache: add fake_lstat()
At times, we may already know that a path represented by a cache_entry ce has no changes via some out-of-line means, like fsmonitor, and yet need the control to go through a codepath that requires us to have "struct stat" obtained by lstat() on the path, for various purposes (e.g. "ie_match_stat()" wants cached stat-info is still current wrt "struct stat", "diff" wants to know st_mode). The callers of lstat() on a tracked file, when its cache_entry knows it is up-to-date, can instead call this helper to pretend that it called lstat() by faking the "struct stat" information. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'statinfo.h')
-rw-r--r--statinfo.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/statinfo.h b/statinfo.h
index 700f502ac0..5b21a30f90 100644
--- a/statinfo.h
+++ b/statinfo.h
@@ -47,6 +47,14 @@ struct stat_validity {
void fill_stat_data(struct stat_data *sd, struct stat *st);
/*
+ * The inverse of the above. When we know the cache_entry that
+ * contains sd is up-to-date, but still need to pretend we called
+ * lstat() to learn that fact, this function fills "st" enough to
+ * fool ie_match_stat().
+ */
+void fake_lstat_data(const struct stat_data *sd, struct stat *st);
+
+/*
* Return 0 if st is consistent with a file not having been changed
* since sd was filled. If there are differences, return a
* combination of MTIME_CHANGED, CTIME_CHANGED, OWNER_CHANGED,