Skip to content

Commit

Permalink
Merge pull request microsoft#415: scalar: enable untracked cache unco…
Browse files Browse the repository at this point in the history
…nditionally

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.
  • Loading branch information
derrickstolee authored and ldennington committed Jan 25, 2022
2 parents 2d44c50 + 51aeeb5 commit 09bd7e3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/scalar-functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions contrib/scalar/scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,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.logAllRefUpdates", "true", 1 },
{ "credential.https://dev.azure.com.useHttpPath", "true", 1 },
{ "credential.validate", "false", 1 }, /* GCM4W-only */
Expand Down
4 changes: 3 additions & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,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 ||
Expand Down

0 comments on commit 09bd7e3

Please sign in to comment.