File tree Expand file tree Collapse file tree 5 files changed +45
-7
lines changed Expand file tree Collapse file tree 5 files changed +45
-7
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,9 @@ core.untrackedCache::
86
86
it will automatically be removed, if set to `false`. Before
87
87
setting it to `true`, you should check that mtime is working
88
88
properly on your system.
89
- See linkgit:git-update-index[1]. `keep` by default.
89
+ See linkgit:git-update-index[1]. `keep` by default, unless
90
+ `feature.manyFiles` is enabled which sets this setting to
91
+ `true` by default.
90
92
91
93
core.checkStat::
92
94
When missing or is set to `default`, many fields in the stat
Original file line number Diff line number Diff line change @@ -12,4 +12,14 @@ feature.manyCommits::
12
12
* `core.commitGraph=true` enables reading the commit-graph file.
13
13
+
14
14
* `gc.writeCommitGraph=true` enables writing the commit-graph file during
15
- garbage collection.
15
+ garbage collection.
16
+
17
+ feature.manyFiles::
18
+ Enable config options that optimize for repos with many files in the
19
+ working directory. With many files, commands such as `git status` and
20
+ `git checkout` may be slow and these new defaults improve performance:
21
+ +
22
+ * `index.version=4` enables path-prefix compression in the index.
23
+ +
24
+ * `core.untrackedCache=true` enables the untracked cache. This setting assumes
25
+ that mtime is working on your machine.
Original file line number Diff line number Diff line change @@ -24,3 +24,4 @@ index.threads::
24
24
index.version::
25
25
Specify the version with which new index files should be
26
26
initialized. This does not affect existing repositories.
27
+ If `feature.manyFiles` is enabled, then the default is 4.
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ void prepare_repo_settings(struct repository *r)
43
43
UPDATE_DEFAULT (r -> settings .core_commit_graph , 1 );
44
44
UPDATE_DEFAULT (r -> settings .gc_write_commit_graph , 1 );
45
45
}
46
+ if (!repo_config_get_bool (r , "feature.manyfiles" , & value ) && value ) {
47
+ UPDATE_DEFAULT (r -> settings .index_version , 4 );
48
+ UPDATE_DEFAULT (r -> settings .core_untracked_cache , UNTRACKED_CACHE_WRITE );
49
+ }
46
50
47
51
/* Hack for test programs like test-dump-untracked-cache */
48
52
if (ignore_untracked_cache_config )
Original file line number Diff line number Diff line change @@ -59,17 +59,38 @@ test_expect_success 'out of bounds index.version issues warning' '
59
59
)
60
60
'
61
61
62
- test_expect_success ' GIT_INDEX_VERSION takes precedence over config' '
62
+ test_index_version () {
63
+ INDEX_VERSION_CONFIG=$1 &&
64
+ FEATURE_MANY_FILES=$2 &&
65
+ ENV_VAR_VERSION=$3
66
+ EXPECTED_OUTPUT_VERSION=$4 &&
63
67
(
64
68
rm -f .git/index &&
65
- GIT_INDEX_VERSION=4 &&
66
- export GIT_INDEX_VERSION &&
67
- git config --add index.version 2 &&
69
+ rm -f .git/config &&
70
+ if test " $INDEX_VERSION_CONFIG " -ne 0
71
+ then
72
+ git config --add index.version $INDEX_VERSION_CONFIG
73
+ fi &&
74
+ git config --add feature.manyFiles $FEATURE_MANY_FILES
75
+ if test " $ENV_VAR_VERSION " -ne 0
76
+ then
77
+ GIT_INDEX_VERSION=$ENV_VAR_VERSION &&
78
+ export GIT_INDEX_VERSION
79
+ else
80
+ unset GIT_INDEX_VERSION
81
+ fi &&
68
82
git add a 2>&1 &&
69
- echo 4 >expect &&
83
+ echo $EXPECTED_OUTPUT_VERSION > expect &&
70
84
test-tool index-version < .git/index > actual &&
71
85
test_cmp expect actual
72
86
)
87
+ }
88
+
89
+ test_expect_success ' index version config precedence' '
90
+ test_index_version 2 false 4 4 &&
91
+ test_index_version 2 true 0 2 &&
92
+ test_index_version 0 true 0 4 &&
93
+ test_index_version 0 true 2 2
73
94
'
74
95
75
96
test_done
You can’t perform that action at this time.
0 commit comments