Merge branch 'ds/commit-graph-gen-v2-fixes'
Fixes to the way generation number v2 in the commit-graph files are (not) handled. * ds/commit-graph-gen-v2-fixes: commit-graph: declare bankruptcy on GDAT chunks commit-graph: fix generation number v2 overflow values commit-graph: start parsing generation v2 (again) commit-graph: fix ordering bug in generation numbers t5318: extract helpers to lib-commit-graph.sh test-read-graph: include extra post-parse info
This commit is contained in:
@ -39,8 +39,8 @@ void git_test_write_commit_graph_or_die(void)
|
||||
#define GRAPH_CHUNKID_OIDFANOUT 0x4f494446 /* "OIDF" */
|
||||
#define GRAPH_CHUNKID_OIDLOOKUP 0x4f49444c /* "OIDL" */
|
||||
#define GRAPH_CHUNKID_DATA 0x43444154 /* "CDAT" */
|
||||
#define GRAPH_CHUNKID_GENERATION_DATA 0x47444154 /* "GDAT" */
|
||||
#define GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW 0x47444f56 /* "GDOV" */
|
||||
#define GRAPH_CHUNKID_GENERATION_DATA 0x47444132 /* "GDA2" */
|
||||
#define GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW 0x47444f32 /* "GDO2" */
|
||||
#define GRAPH_CHUNKID_EXTRAEDGES 0x45444745 /* "EDGE" */
|
||||
#define GRAPH_CHUNKID_BLOOMINDEXES 0x42494458 /* "BIDX" */
|
||||
#define GRAPH_CHUNKID_BLOOMDATA 0x42444154 /* "BDAT" */
|
||||
@ -407,6 +407,9 @@ struct commit_graph *parse_commit_graph(struct repository *r,
|
||||
&graph->chunk_generation_data);
|
||||
pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW,
|
||||
&graph->chunk_generation_data_overflow);
|
||||
|
||||
if (graph->chunk_generation_data)
|
||||
graph->read_generation_data = 1;
|
||||
}
|
||||
|
||||
if (r->settings.commit_graph_read_changed_paths) {
|
||||
@ -803,7 +806,7 @@ static void fill_commit_graph_info(struct commit *item, struct commit_graph *g,
|
||||
die(_("commit-graph requires overflow generation data but has none"));
|
||||
|
||||
offset_pos = offset ^ CORRECTED_COMMIT_DATE_OFFSET_OVERFLOW;
|
||||
graph_data->generation = get_be64(g->chunk_generation_data_overflow + 8 * offset_pos);
|
||||
graph_data->generation = item->date + get_be64(g->chunk_generation_data_overflow + 8 * offset_pos);
|
||||
} else
|
||||
graph_data->generation = item->date + offset;
|
||||
} else
|
||||
@ -1556,12 +1559,16 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
|
||||
if (current->date && current->date > max_corrected_commit_date)
|
||||
max_corrected_commit_date = current->date - 1;
|
||||
commit_graph_data_at(current)->generation = max_corrected_commit_date + 1;
|
||||
|
||||
if (commit_graph_data_at(current)->generation - current->date > GENERATION_NUMBER_V2_OFFSET_MAX)
|
||||
ctx->num_generation_data_overflows++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ctx->commits.nr; i++) {
|
||||
struct commit *c = ctx->commits.list[i];
|
||||
timestamp_t offset = commit_graph_data_at(c)->generation - c->date;
|
||||
if (offset > GENERATION_NUMBER_V2_OFFSET_MAX)
|
||||
ctx->num_generation_data_overflows++;
|
||||
}
|
||||
stop_progress(&ctx->progress);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user