mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
@@ -46,6 +46,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
|
||||
|
||||
Reference in New Issue
Block a user