commit-graph: use repo_parse_commit

The write_commit_graph_context has a repository pointer, so use it. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Feb 1, 2021 at 17:15 UTC c4cc08316944d17fc214bdad47bb4e92c31d0751
2 files changed +8 -7
commit-graph.c
+5 -5
@@ -1098,7 +1098,7 @@ static int write_graph_chunk_data(struct hashfile *f,
1098 uint32_t packedDate[2];
1099 display_progress(ctx->progress, ++ctx->progress_cnt);
1100
1101 - if (parse_commit_no_graph(*list))
1101 + if (repo_parse_commit_no_graph(ctx->r, *list))
1102 die(_("unable to parse commit %s"),
1103 oid_to_hex(&(*list)->object.oid));
1104 tree = get_commit_tree_oid(*list);
@@ -1411,11 +1411,11 @@ static void close_reachable(struct write_commit_graph_context *ctx)
1411 if (!commit)
1412 continue;
1413 if (ctx->split) {
1414 - if ((!parse_commit(commit) &&
1414 + if ((!repo_parse_commit(ctx->r, commit) &&
1415 commit_graph_position(commit) == COMMIT_NOT_FROM_GRAPH) ||
1416 flags == COMMIT_GRAPH_SPLIT_REPLACE)
1417 add_missing_parents(ctx, commit);
1418 - } else if (!parse_commit_no_graph(commit))
1418 + } else if (!repo_parse_commit_no_graph(ctx->r, commit))
1419 add_missing_parents(ctx, commit);
1420 }
1421 stop_progress(&ctx->progress);
@@ -1710,9 +1710,9 @@ static void copy_oids_to_commits(struct write_commit_graph_context *ctx)
1710 continue;
1711
1712 if (ctx->split && flags == COMMIT_GRAPH_SPLIT_REPLACE)
1713 - parse_commit(ctx->commits.list[ctx->commits.nr]);
1713 + repo_parse_commit(ctx->r, ctx->commits.list[ctx->commits.nr]);
1714 else
1715 - parse_commit_no_graph(ctx->commits.list[ctx->commits.nr]);
1715 + repo_parse_commit_no_graph(ctx->r, ctx->commits.list[ctx->commits.nr]);
1716
1717 num_parents = commit_list_count(ctx->commits.list[ctx->commits.nr]->parents);
1718 if (num_parents > 2)
commit.h
+3 -2
@@ -89,9 +89,10 @@ static inline int repo_parse_commit(struct repository *r, struct commit *item)
89 return repo_parse_commit_gently(r, item, 0);
90 }
91
92 -static inline int parse_commit_no_graph(struct commit *commit)
92 +static inline int repo_parse_commit_no_graph(struct repository *r,
93 + struct commit *commit)
94 {
94 - return repo_parse_commit_internal(the_repository, commit, 0, 0);
95 + return repo_parse_commit_internal(r, commit, 0, 0);
96 }
97
98 #ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS