Skip to content

Commit da3045e

Browse files
committed
Merge pull request #415: scalar: enable untracked cache unconditionally
No matter what I try, I cannot get the untracked cache to fail on Windows. Here are the things that are done in this pull request: 1. Scalar enables the untracked cache unconditionally via `core.untrackedCache = true`. This was previously set to `false` on Windows. 2. Set `GIT_FORCE_UNTRACKED_CACHE=1` for the Scalar functional tests. 3. Update the `core.untrackedCache` config variable to be as strong as the `GIT_FORCE_UNTRACKED_CACHE` environment variable.
2 parents 1feb45f + 71d1275 commit da3045e

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

.github/workflows/scalar-functional-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535

3636
env:
3737
BUILD_FRAGMENT: bin/Release/netcoreapp3.1
38+
GIT_FORCE_UNTRACKED_CACHE: 1
3839

3940
steps:
4041
- name: Check out Git's source code

contrib/scalar/scalar.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,7 @@ static int set_recommended_config(int reconfigure)
156156
{ "core.FSCache", "true", 1 },
157157
{ "core.multiPackIndex", "true", 1 },
158158
{ "core.preloadIndex", "true", 1 },
159-
#ifndef WIN32
160159
{ "core.untrackedCache", "true", 1 },
161-
#else
162-
/*
163-
* Unfortunately, Scalar's Functional Tests demonstrated
164-
* that the untracked cache feature is unreliable on Windows
165-
* (which is a bummer because that platform would benefit the
166-
* most from it). For some reason, freshly created files seem
167-
* not to update the directory's `lastModified` time
168-
* immediately, but the untracked cache would need to rely on
169-
* that.
170-
*
171-
* Therefore, with a sad heart, we disable this very useful
172-
* feature on Windows.
173-
*/
174-
{ "core.untrackedCache", "false", 1 },
175-
#endif
176160
{ "core.bare", "false", 1 },
177161
{ "core.logAllRefUpdates", "true", 1 },
178162
{ "credential.https://dev.azure.com.useHttpPath", "true", 1 },

dir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3063,7 +3063,9 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
30633063

30643064
if (force_untracked_cache < 0)
30653065
force_untracked_cache =
3066-
git_env_bool("GIT_FORCE_UNTRACKED_CACHE", 0);
3066+
git_env_bool("GIT_FORCE_UNTRACKED_CACHE", -1);
3067+
if (force_untracked_cache < 0)
3068+
force_untracked_cache = (istate->repo->settings.core_untracked_cache == UNTRACKED_CACHE_WRITE);
30673069
if (force_untracked_cache &&
30683070
dir->untracked == istate->untracked &&
30693071
(dir->untracked->dir_opened ||

0 commit comments

Comments
 (0)