diff --git a/lib/compat/win32/fscache.c b/lib/compat/win32/fscache.c index ad9af19442..bb89cc0fe8 100644 --- a/lib/compat/win32/fscache.c +++ b/lib/compat/win32/fscache.c @@ -12,11 +12,6 @@ static struct hashmap map; static CRITICAL_SECTION mutex; static struct trace_key trace_fscache = TRACE_KEY_INIT(FSCACHE); -int fscache_is_enabled(void) -{ - return enabled; -} - /* * An entry in the file system cache. Used for both entire directory listings * and file entries. @@ -280,7 +275,7 @@ static void fscache_clear(void) /* * Checks if the cache is enabled for the given path. */ -static inline int fscache_enabled(const char *path) +int fscache_enabled(const char *path) { return enabled > 0 && !is_absolute_path(path); } diff --git a/lib/compat/win32/fscache.h b/lib/compat/win32/fscache.h index fc31c17863..1dd7aec1d0 100644 --- a/lib/compat/win32/fscache.h +++ b/lib/compat/win32/fscache.h @@ -7,8 +7,8 @@ int fscache_enable(int enable); void fscache_flush(void); #define flush_fscache() fscache_flush() -int fscache_is_enabled(void); -#define is_fscache_enabled() (fscache_is_enabled()) +int fscache_enabled(const char *path); +#define is_fscache_enabled(path) fscache_enabled(path) DIR *fscache_opendir(const char *dir); int fscache_lstat(const char *file_name, struct stat *buf); diff --git a/lib/dir.c b/lib/dir.c index 285e091317..1da196882e 100644 --- a/lib/dir.c +++ b/lib/dir.c @@ -1162,7 +1162,7 @@ static int add_patterns(const char *fname, const char *base, int baselen, * We do want to keep the conditional block for the sake of Windows, * though, so let's use the `NOT_CONSTANT()` trick to suppress that error. */ - if (NOT_CONSTANT(is_fscache_enabled())) { + if (NOT_CONSTANT(is_fscache_enabled(fname))) { if (lstat(fname, &st) < 0) { fd = -1; } else { diff --git a/lib/git-compat-util.h b/lib/git-compat-util.h index 1c09ea0c3b..64199c0105 100644 --- a/lib/git-compat-util.h +++ b/lib/git-compat-util.h @@ -1127,7 +1127,7 @@ static inline int is_missing_file_error(int errno_) #endif #ifndef is_fscache_enabled -#define is_fscache_enabled() (0) +#define is_fscache_enabled(path) (0) #endif int cmd_main(int, const char **);