commit-graph: introduce 'commitGraph.maxNewFilters'
Introduce a configuration variable to specify a default value for the recently-introduce '--max-new-filters' option of 'git commit-graph write'. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
809e0327f5
commit
d356d5debe
@ -1,3 +1,7 @@
|
|||||||
|
commitGraph.maxNewFilters::
|
||||||
|
Specifies the default value for the `--max-new-filters` option of `git
|
||||||
|
commit-graph write` (c.f., linkgit:git-commit-graph[1]).
|
||||||
|
|
||||||
commitGraph.readChangedPaths::
|
commitGraph.readChangedPaths::
|
||||||
If true, then git will use the changed-path Bloom filters in the
|
If true, then git will use the changed-path Bloom filters in the
|
||||||
commit-graph file (if it exists, and they are present). Defaults to
|
commit-graph file (if it exists, and they are present). Defaults to
|
||||||
|
@ -71,7 +71,8 @@ With the `--max-new-filters=<n>` option, generate at most `n` new Bloom
|
|||||||
filters (if `--changed-paths` is specified). If `n` is `-1`, no limit is
|
filters (if `--changed-paths` is specified). If `n` is `-1`, no limit is
|
||||||
enforced. Only commits present in the new layer count against this
|
enforced. Only commits present in the new layer count against this
|
||||||
limit. To retroactively compute Bloom filters over earlier layers, it is
|
limit. To retroactively compute Bloom filters over earlier layers, it is
|
||||||
advised to use `--split=replace`.
|
advised to use `--split=replace`. Overrides the `commitGraph.maxNewFilters`
|
||||||
|
configuration.
|
||||||
+
|
+
|
||||||
With the `--split[=<strategy>]` option, write the commit-graph as a
|
With the `--split[=<strategy>]` option, write the commit-graph as a
|
||||||
chain of multiple commit-graph files stored in
|
chain of multiple commit-graph files stored in
|
||||||
|
@ -181,6 +181,18 @@ static int write_option_max_new_filters(const struct option *opt,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int git_commit_graph_write_config(const char *var, const char *value,
|
||||||
|
void *cb)
|
||||||
|
{
|
||||||
|
if (!strcmp(var, "commitgraph.maxnewfilters"))
|
||||||
|
write_opts.max_new_filters = git_config_int(var, value);
|
||||||
|
/*
|
||||||
|
* No need to fall-back to 'git_default_config', since this was already
|
||||||
|
* called in 'cmd_commit_graph()'.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int graph_write(int argc, const char **argv)
|
static int graph_write(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
struct string_list pack_indexes = STRING_LIST_INIT_NODUP;
|
struct string_list pack_indexes = STRING_LIST_INIT_NODUP;
|
||||||
@ -231,6 +243,8 @@ static int graph_write(int argc, const char **argv)
|
|||||||
|
|
||||||
trace2_cmd_mode("write");
|
trace2_cmd_mode("write");
|
||||||
|
|
||||||
|
git_config(git_commit_graph_write_config, &opts);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, NULL,
|
argc = parse_options(argc, argv, NULL,
|
||||||
builtin_commit_graph_write_options,
|
builtin_commit_graph_write_options,
|
||||||
builtin_commit_graph_write_usage, 0);
|
builtin_commit_graph_write_usage, 0);
|
||||||
|
@ -325,13 +325,15 @@ test_expect_success 'Bloom generation is limited by --max-new-filters' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'Bloom generation backfills previously-skipped filters' '
|
test_expect_success 'Bloom generation backfills previously-skipped filters' '
|
||||||
|
# Check specifying commitGraph.maxNewFilters over "git config" works.
|
||||||
|
test_config -C limits commitGraph.maxNewFilters 1 &&
|
||||||
(
|
(
|
||||||
cd limits &&
|
cd limits &&
|
||||||
|
|
||||||
rm -f trace.event &&
|
rm -f trace.event &&
|
||||||
GIT_TRACE2_EVENT="$(pwd)/trace.event" \
|
GIT_TRACE2_EVENT="$(pwd)/trace.event" \
|
||||||
git commit-graph write --reachable --changed-paths \
|
git commit-graph write --reachable --changed-paths \
|
||||||
--split=replace --max-new-filters=1 &&
|
--split=replace &&
|
||||||
test_filter_computed 1 trace.event &&
|
test_filter_computed 1 trace.event &&
|
||||||
test_filter_not_computed 4 trace.event &&
|
test_filter_not_computed 4 trace.event &&
|
||||||
test_filter_trunc_empty 0 trace.event &&
|
test_filter_trunc_empty 0 trace.event &&
|
||||||
@ -339,6 +341,26 @@ test_expect_success 'Bloom generation backfills previously-skipped filters' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success '--max-new-filters overrides configuration' '
|
||||||
|
git init override &&
|
||||||
|
test_when_finished "rm -fr override" &&
|
||||||
|
test_config -C override commitGraph.maxNewFilters 2 &&
|
||||||
|
(
|
||||||
|
cd override &&
|
||||||
|
test_commit one &&
|
||||||
|
test_commit two &&
|
||||||
|
|
||||||
|
rm -f trace.event &&
|
||||||
|
GIT_TRACE2_EVENT="$(pwd)/trace.event" \
|
||||||
|
git commit-graph write --reachable --changed-paths \
|
||||||
|
--max-new-filters=1 &&
|
||||||
|
test_filter_computed 1 trace.event &&
|
||||||
|
test_filter_not_computed 1 trace.event &&
|
||||||
|
test_filter_trunc_empty 0 trace.event &&
|
||||||
|
test_filter_trunc_large 0 trace.event
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'Bloom generation backfills empty commits' '
|
test_expect_success 'Bloom generation backfills empty commits' '
|
||||||
git init empty &&
|
git init empty &&
|
||||||
test_when_finished "rm -fr empty" &&
|
test_when_finished "rm -fr empty" &&
|
||||||
|
Loading…
Reference in New Issue
Block a user