Skip to content

Commit 8f776be

Browse files
committed
Merge branch 'ds/feature-macros' into pu
A mechanism to affect the default setting for a (related) group of configuration variables is introduced. * ds/feature-macros: repo-settings: create feature.experimental setting repo-settings: create feature.manyFiles setting repo-settings: parse core.untrackedCache commit-graph: turn on commit-graph by default t6501: use 'git gc' in quiet mode repo-settings: consolidate some config settings
2 parents 3d40fba + aaf633c commit 8f776be

26 files changed

+224
-115
lines changed

Documentation/config.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ include::config/difftool.txt[]
345345

346346
include::config/fastimport.txt[]
347347

348+
include::config/feature.txt[]
349+
348350
include::config/fetch.txt[]
349351

350352
include::config/format.txt[]

Documentation/config/core.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ core.untrackedCache::
8686
it will automatically be removed, if set to `false`. Before
8787
setting it to `true`, you should check that mtime is working
8888
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.
9092

9193
core.checkStat::
9294
When missing or is set to `default`, many fields in the stat
@@ -577,7 +579,7 @@ the `GIT_NOTES_REF` environment variable. See linkgit:git-notes[1].
577579

578580
core.commitGraph::
579581
If true, then git will read the commit-graph file (if it exists)
580-
to parse the graph structure of commits. Defaults to false. See
582+
to parse the graph structure of commits. Defaults to true. See
581583
linkgit:git-commit-graph[1] for more information.
582584

583585
core.useReplaceRefs::

Documentation/config/feature.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
feature.*::
2+
The config settings that start with `feature.` modify the defaults of
3+
a group of other config settings. These groups are created by the Git
4+
developer community as recommended defaults and are subject to change.
5+
In particular, new config options may be added with different defaults.
6+
7+
feature.experimental::
8+
Enable config options that are new to Git, and are being considered for
9+
future defaults. Config settings included here may be added or removed
10+
with each release, including minor version updates. These settings may
11+
have unintended interactions since they are so new. Please enable this
12+
setting if you are interested in providing feedback on experimental
13+
features. The new default values are:
14+
+
15+
* `pack.useSparse=true` uses a new algorithm when constructing a pack-file
16+
which can improve `git push` performance in repos with many files.
17+
+
18+
* `fetch.negotiationAlgorithm=skipping` may improve fetch negotiation times by
19+
skipping more commits at a time, reducing the number of round trips.
20+
21+
feature.manyFiles::
22+
Enable config options that optimize for repos with many files in the
23+
working directory. With many files, commands such as `git status` and
24+
`git checkout` may be slow and these new defaults improve performance:
25+
+
26+
* `index.version=4` enables path-prefix compression in the index.
27+
+
28+
* `core.untrackedCache=true` enables the untracked cache. This setting assumes
29+
that mtime is working on your machine.

Documentation/config/fetch.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ fetch.negotiationAlgorithm::
5959
effort to converge faster, but may result in a larger-than-necessary
6060
packfile; The default is "default" which instructs Git to use the default algorithm
6161
that never skips commits (unless the server has acknowledged it or one
62-
of its descendants).
62+
of its descendants). If `feature.experimental` is enabled, then this
63+
setting defaults to "skipping".
6364
Unknown values will cause 'git fetch' to error out.
6465
+
6566
See also the `--negotiation-tip` option for linkgit:git-fetch[1].

Documentation/config/gc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ gc.writeCommitGraph::
6363
If true, then gc will rewrite the commit-graph file when
6464
linkgit:git-gc[1] is run. When using `git gc --auto`
6565
the commit-graph will be updated if housekeeping is
66-
required. Default is false. See linkgit:git-commit-graph[1]
66+
required. Default is true. See linkgit:git-commit-graph[1]
6767
for details.
6868

6969
gc.logExpiry::

Documentation/config/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ index.threads::
2424
index.version::
2525
Specify the version with which new index files should be
2626
initialized. This does not affect existing repositories.
27+
If `feature.manyFiles` is enabled, then the default is 4.

Documentation/config/pack.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ pack.useSparse::
112112
objects. This can have significant performance benefits when
113113
computing a pack to send a small change. However, it is possible
114114
that extra objects are added to the pack-file if the included
115-
commits contain certain types of direct renames.
115+
commits contain certain types of direct renames. Default is `false`
116+
unless `feature.experimental` is enabled.
116117

117118
pack.writeBitmaps (deprecated)::
118119
This is a deprecated synonym for `repack.writeBitmaps`.

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,7 @@ LIB_OBJS += refspec.o
968968
LIB_OBJS += ref-filter.o
969969
LIB_OBJS += remote.o
970970
LIB_OBJS += replace-object.o
971+
LIB_OBJS += repo-settings.o
971972
LIB_OBJS += repository.o
972973
LIB_OBJS += rerere.o
973974
LIB_OBJS += resolve-undo.o

builtin/gc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ static int aggressive_depth = 50;
4242
static int aggressive_window = 250;
4343
static int gc_auto_threshold = 6700;
4444
static int gc_auto_pack_limit = 50;
45-
static int gc_write_commit_graph;
4645
static int detach_auto = 1;
4746
static timestamp_t gc_log_expire_time;
4847
static const char *gc_log_expire = "1.day.ago";
@@ -149,7 +148,6 @@ static void gc_config(void)
149148
git_config_get_int("gc.aggressivedepth", &aggressive_depth);
150149
git_config_get_int("gc.auto", &gc_auto_threshold);
151150
git_config_get_int("gc.autopacklimit", &gc_auto_pack_limit);
152-
git_config_get_bool("gc.writecommitgraph", &gc_write_commit_graph);
153151
git_config_get_bool("gc.autodetach", &detach_auto);
154152
git_config_get_expiry("gc.pruneexpire", &prune_expire);
155153
git_config_get_expiry("gc.worktreepruneexpire", &prune_worktrees_expire);
@@ -686,11 +684,11 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
686684
clean_pack_garbage();
687685
}
688686

689-
if (gc_write_commit_graph &&
690-
write_commit_graph_reachable(get_object_directory(),
691-
!quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0,
692-
NULL))
693-
return 1;
687+
prepare_repo_settings(the_repository);
688+
if (the_repository->settings.gc_write_commit_graph == 1)
689+
write_commit_graph_reachable(get_object_directory(),
690+
!quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0,
691+
NULL);
694692

695693
if (auto_gc && too_many_loose_objects())
696694
warning(_("There are too many unreachable loose objects; "

builtin/pack-objects.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,10 +2704,6 @@ static int git_pack_config(const char *k, const char *v, void *cb)
27042704
use_bitmap_index_default = git_config_bool(k, v);
27052705
return 0;
27062706
}
2707-
if (!strcmp(k, "pack.usesparse")) {
2708-
sparse = git_config_bool(k, v);
2709-
return 0;
2710-
}
27112707
if (!strcmp(k, "pack.threads")) {
27122708
delta_search_threads = git_config_int(k, v);
27132709
if (delta_search_threads < 0)
@@ -3332,6 +3328,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
33323328
read_replace_refs = 0;
33333329

33343330
sparse = git_env_bool("GIT_TEST_PACK_SPARSE", 0);
3331+
prepare_repo_settings(the_repository);
3332+
if (!sparse && the_repository->settings.pack_use_sparse != -1)
3333+
sparse = the_repository->settings.pack_use_sparse;
3334+
33353335
reset_pack_idx_option(&pack_idx_opts);
33363336
git_config(git_pack_config, NULL);
33373337

0 commit comments

Comments
 (0)