From e31fe77836ec4675500e9832fdfc203ef7600a78 Mon Sep 17 00:00:00 2001
From: Ben Peart <benpeart@microsoft.com>
Date: Thu, 4 Oct 2018 18:10:21 -0400
Subject: [PATCH] fscache: add GIT_TEST_FSCACHE support

Add support to fscache to enable running the entire test suite with the
fscache enabled.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
---
 compat/win32/fscache.c | 5 +++++
 t/README               | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/compat/win32/fscache.c b/compat/win32/fscache.c
index c5b261b776be3a..2f56f24fc282b5 100644
--- a/compat/win32/fscache.c
+++ b/compat/win32/fscache.c
@@ -5,6 +5,7 @@
 #include "../../dir.h"
 #include "../../abspath.h"
 #include "../../trace.h"
+#include "config.h"
 
 static int initialized;
 static volatile long enabled;
@@ -401,7 +402,11 @@ int fscache_enable(int enable)
 	int result;
 
 	if (!initialized) {
+		int fscache = git_env_bool("GIT_TEST_FSCACHE", -1);
+
 		/* allow the cache to be disabled entirely */
+		if (fscache != -1)
+			core_fscache = fscache;
 		if (!core_fscache)
 			return 0;
 
diff --git a/t/README b/t/README
index 17f16c2af409e2..ef838b334ba850 100644
--- a/t/README
+++ b/t/README
@@ -479,6 +479,9 @@ GIT_TEST_FULL_NAME_HASH=<boolean>, when true, sets the default name-hash
 function in 'git pack-objects' to be the one used by the --full-name-hash
 option.
 
+GIT_TEST_FSCACHE=<boolean> exercises the uncommon fscache code path
+which adds a cache below mingw's lstat and dirent implementations.
+
 Naming Tests
 ------------