THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

commit-graph: parse commit from chosen graph

Before verifying a commit-graph file against the object database, we
need to parse all commits from the given commit-graph file. Create
parse_commit_in_graph_one() to target a given struct commit_graph.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tags/v2.19.0-rc0
Derrick Stolee Junio C Hamano 1 year ago
parent
commit
ee79705311
1 changed files with 15 additions and 3 deletions
  1. +15
    -3
      commit-graph.c

+ 15
- 3
commit-graph.c View File

@@ -314,7 +314,7 @@ static int find_commit_in_graph(struct commit *item, struct commit_graph *g, uin
}
}

int parse_commit_in_graph(struct commit *item)
static int parse_commit_in_graph_one(struct commit_graph *g, struct commit *item)
{
uint32_t pos;

@@ -322,9 +322,21 @@ int parse_commit_in_graph(struct commit *item)
return 0;
if (item->object.parsed)
return 1;

if (find_commit_in_graph(item, g, &pos))
return fill_commit_in_graph(item, g, pos);

return 0;
}

int parse_commit_in_graph(struct commit *item)
{
if (!core_commit_graph)
return 0;

prepare_commit_graph();
if (commit_graph && find_commit_in_graph(item, commit_graph, &pos))
return fill_commit_in_graph(item, commit_graph, pos);
if (commit_graph)
return parse_commit_in_graph_one(commit_graph, item);
return 0;
}



Loading…
Cancel
Save