Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/commit-graph.c b/commit-graph.c
index a7d2fe883f..e5f9e75e18 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -277,8 +277,6 @@ struct commit_graph *load_commit_graph_one_fd_st(struct repository *r,
static int verify_commit_graph_lite(struct commit_graph *g)
{
- int i;
-
/*
* Basic validation shared between parse_commit_graph()
* which'll be called every time the graph is used, and the
@@ -291,16 +289,6 @@ static int verify_commit_graph_lite(struct commit_graph *g)
* over g->num_commits, or runs a checksum on the commit-graph
* itself.
*/
- for (i = 0; i < 255; i++) {
- uint32_t oid_fanout1 = ntohl(g->chunk_oid_fanout[i]);
- uint32_t oid_fanout2 = ntohl(g->chunk_oid_fanout[i + 1]);
-
- if (oid_fanout1 > oid_fanout2) {
- error("commit-graph fanout values out of order");
- return 1;
- }
- }
-
return 0;
}
@@ -308,10 +296,23 @@ static int graph_read_oid_fanout(const unsigned char *chunk_start,
size_t chunk_size, void *data)
{
struct commit_graph *g = data;
+ int i;
+
if (chunk_size != 256 * sizeof(uint32_t))
return error("commit-graph oid fanout chunk is wrong size");
g->chunk_oid_fanout = (const uint32_t *)chunk_start;
g->num_commits = ntohl(g->chunk_oid_fanout[255]);
+
+ for (i = 0; i < 255; i++) {
+ uint32_t oid_fanout1 = ntohl(g->chunk_oid_fanout[i]);
+ uint32_t oid_fanout2 = ntohl(g->chunk_oid_fanout[i + 1]);
+
+ if (oid_fanout1 > oid_fanout2) {
+ error("commit-graph fanout values out of order");
+ return 1;
+ }
+ }
+
return 0;
}