summaryrefslogtreecommitdiff
path: root/builtin/commit-graph.c
diff options
context:
space:
mode:
authorLibravatar Taylor Blau <me@ttaylorr.com>2020-09-17 22:59:57 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-09-18 10:39:22 -0700
commitd356d5debe56b1e43b5ca674c662a08f25176f05 (patch)
tree03e69433cd878a92e5fa9f344a7b9c861cdf5a81 /builtin/commit-graph.c
parentbuiltin/commit-graph.c: introduce '--max-new-filters=<n>' (diff)
downloadtgif-d356d5debe56b1e43b5ca674c662a08f25176f05.tar.xz
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>
Diffstat (limited to 'builtin/commit-graph.c')
-rw-r--r--builtin/commit-graph.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 5df9b2ef80..988445abdf 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -181,6 +181,18 @@ static int write_option_max_new_filters(const struct option *opt,
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)
{
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");
+ git_config(git_commit_graph_write_config, &opts);
+
argc = parse_options(argc, argv, NULL,
builtin_commit_graph_write_options,
builtin_commit_graph_write_usage, 0);