diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2020-01-02 16:14:14 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-02 13:46:34 -0800 |
commit | 63020f175fe26f3250ac8d19d02ef9ee271006e5 (patch) | |
tree | e81c6d335b0f3612f2520d3b0ec7f16a267129c1 /commit-graph.c | |
parent | 53a06cf39b756eddfe4a2a34da93e3d04eb7b728 (diff) | |
download | git-63020f175fe26f3250ac8d19d02ef9ee271006e5.tar.gz |
commit-graph: prefer default size_mult when given zero
In 50f26bd ("fetch: add fetch.writeCommitGraph config setting",
2019-09-02), the fetch builtin added the capability to write a
commit-graph using the "--split" feature. This feature creates
multiple commit-graph files, and those can merge based on a set
of "split options" including a size multiple. The default size
multiple is 2, which intends to provide a log_2 N depth of the
commit-graph chain where N is the number of commits.
However, I noticed during dogfooding that my commit-graph chains
were becoming quite large when left only to builds by 'git fetch'.
It turns out that in split_graph_merge_strategy(), we default the
size_mult variable to 2 except we override it with the context's
split_opts if they exist. In builtin/fetch.c, we create such a
split_opts, but do not populate it with values.
This problem is due to two failures:
1. It is unclear that we can add the flag COMMIT_GRAPH_WRITE_SPLIT
with a NULL split_opts.
2. If we have a non-NULL split_opts, then we override the default
values even if a zero value is given.
Correct both of these issues. First, do not override size_mult when
the options provide a zero value. Second, stop creating a split_opts
in the fetch builtin.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/commit-graph.c b/commit-graph.c index 0aea7b2ae5..baa1a266b4 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1545,7 +1545,9 @@ static void split_graph_merge_strategy(struct write_commit_graph_context *ctx) if (ctx->split_opts) { max_commits = ctx->split_opts->max_commits; - size_mult = ctx->split_opts->size_multiple; + + if (ctx->split_opts->size_multiple) + size_mult = ctx->split_opts->size_multiple; } g = ctx->r->objects->commit_graph; |