From a6f953a18b21a7328a1ea486ca8464f6178bf468 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 21 Jun 2021 08:21:48 -0400 Subject: [PATCH 1/3] scalar: enable untracked cache unconditionally Signed-off-by: Derrick Stolee --- contrib/scalar/scalar.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c index b8908cb383a1fa..49dfaafa0baf9c 100644 --- a/contrib/scalar/scalar.c +++ b/contrib/scalar/scalar.c @@ -156,23 +156,7 @@ static int set_recommended_config(int reconfigure) { "core.FSCache", "true", 1 }, { "core.multiPackIndex", "true", 1 }, { "core.preloadIndex", "true", 1 }, -#ifndef WIN32 { "core.untrackedCache", "true", 1 }, -#else - /* - * Unfortunately, Scalar's Functional Tests demonstrated - * that the untracked cache feature is unreliable on Windows - * (which is a bummer because that platform would benefit the - * most from it). For some reason, freshly created files seem - * not to update the directory's `lastModified` time - * immediately, but the untracked cache would need to rely on - * that. - * - * Therefore, with a sad heart, we disable this very useful - * feature on Windows. - */ - { "core.untrackedCache", "false", 1 }, -#endif { "core.bare", "false", 1 }, { "core.logAllRefUpdates", "true", 1 }, { "credential.https://dev.azure.com.useHttpPath", "true", 1 }, From 4b47995a67e9a7c665b9e1c4f8dc5c2bc8c224a3 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Fri, 27 Aug 2021 09:45:19 -0400 Subject: [PATCH 2/3] Use GIT_FORCE_UNTRACKED_CACHE in functional tests Signed-off-by: Derrick Stolee --- .github/workflows/scalar-functional-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scalar-functional-tests.yml b/.github/workflows/scalar-functional-tests.yml index 870a079c9c55d2..acc2a5c9b71f93 100644 --- a/.github/workflows/scalar-functional-tests.yml +++ b/.github/workflows/scalar-functional-tests.yml @@ -35,6 +35,7 @@ jobs: env: BUILD_FRAGMENT: bin/Release/netcoreapp3.1 + GIT_FORCE_UNTRACKED_CACHE: 1 steps: - name: Check out Git's source code From 9ea0015d5e40821e4e598c6b16293d132177a376 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 30 Aug 2021 16:44:57 -0400 Subject: [PATCH 3/3] dir: force untracked cache with core.untrackedCache The GIT_FORCE_UNTRACKED_CACHE environment variable write the untracked cache more frequently than the core.untrackedCache config variable. This is due to how read_directory() handles the creation of an untracked cache. The old mechanism required using something like 'git update-index --untracked-cache' before the index would actually contain an untracked cache. This was noted as a performance problem on macOS in the past, and this is the resolution for that issue. Signed-off-by: Derrick Stolee --- dir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dir.c b/dir.c index d8381641998c09..4fceba5ec8decc 100644 --- a/dir.c +++ b/dir.c @@ -3053,7 +3053,9 @@ int read_directory(struct dir_struct *dir, struct index_state *istate, if (force_untracked_cache < 0) force_untracked_cache = - git_env_bool("GIT_FORCE_UNTRACKED_CACHE", 0); + git_env_bool("GIT_FORCE_UNTRACKED_CACHE", -1); + if (force_untracked_cache < 0) + force_untracked_cache = (istate->repo->settings.core_untracked_cache == UNTRACKED_CACHE_WRITE); if (force_untracked_cache && dir->untracked == istate->untracked && (dir->untracked->dir_opened ||