96
static struct commit_graph_data_slab commit_graph_data_slab =
97
COMMIT_SLAB_INIT(1, commit_graph_data_slab);
98
99
+static int get_configured_generation_version(struct repository *r)
100
+{
101
+ int version = 2;
102
+ repo_config_get_int(r, "commitgraph.generationversion", &version);
103
+ return version;
104
+}
105
+
106
uint32_t commit_graph_position(const struct commit *c)
107
{
108
struct commit_graph_data *data =
401
pair_chunk(cf, GRAPH_CHUNKID_DATA, &graph->chunk_commit_data);
402
pair_chunk(cf, GRAPH_CHUNKID_EXTRAEDGES, &graph->chunk_extra_edges);
403
pair_chunk(cf, GRAPH_CHUNKID_BASE, &graph->chunk_base_graphs);
397
- pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA,
398
- &graph->chunk_generation_data);
399
- pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW,
400
- &graph->chunk_generation_data_overflow);
404
+
405
+ if (get_configured_generation_version(r) >= 2) {
406
+ pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA,
407
+ &graph->chunk_generation_data);
408
+ pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW,
409
+ &graph->chunk_generation_data_overflow);
410
+ }
411
412
if (r->settings.commit_graph_read_changed_paths) {
413
pair_chunk(cf, GRAPH_CHUNKID_BLOOMINDEXES,
1781
add_chunk(cf, GRAPH_CHUNKID_DATA, (hashsz + 16) * ctx->commits.nr,
1782
write_graph_chunk_data);
1783
1774
- if (git_env_bool(GIT_TEST_COMMIT_GRAPH_NO_GDAT, 0))
1775
- ctx->write_generation_data = 0;
1784
if (ctx->write_generation_data)
1785
add_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA,
1786
sizeof(uint32_t) * ctx->commits.nr,
2187
ctx->split = flags & COMMIT_GRAPH_WRITE_SPLIT ? 1 : 0;
2188
ctx->opts = opts;
2189
ctx->total_bloom_filter_data_size = 0;
2182
- ctx->write_generation_data = 1;
2190
+ ctx->write_generation_data = (get_configured_generation_version(r) == 2);
2191
ctx->num_generation_data_overflows = 0;
2192
2193
bloom_settings.bits_per_entry = git_env_ulong("GIT_TEST_BLOOM_SETTINGS_BITS_PER_ENTRY",