commit-graph: remove a duplicate assignment

Leave the variable 'g' uninitialized before it is set just before its first use in front of a loop, which is a much more appropriate place to indicate what it is used for. Also initialize the variable 'num_commits' just before the loop instead of at the beginning of the function for the same reason. Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Alex Henrie committed Sep 30, 2019 at 20:29 UTC 8da02ce62a4e76aea7a02d56b66b10eedc8e6db8
1 file changed +3 -2
commit-graph.c
+3 -2
@@ -1519,8 +1519,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
1519
1520 static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
1521 {
1522 - struct commit_graph *g = ctx->r->objects->commit_graph;
1523 - uint32_t num_commits = ctx->commits.nr;
1522 + struct commit_graph *g;
1523 + uint32_t num_commits;
1524 uint32_t i;
1525
1526 int max_commits = 0;
@@ -1532,6 +1532,7 @@ static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
1532 }
1533
1534 g = ctx->r->objects->commit_graph;
1535 + num_commits = ctx->commits.nr;
1536 ctx->num_commit_graphs_after = ctx->num_commit_graphs_before + 1;
1537
1538 while (g && (g->num_commits <= size_mult * num_commits ||