diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-08-15 07:49:52 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-08-15 09:34:48 -0700 |
| commit | 7be9e410b22b3544e01d32f7bef8e6aa9516e152 (patch) | |
| tree | ddb18c3442e8a198df37123c0c1e1e1ffc3f4b16 /builtin/commit-graph.c | |
| parent | commit-graph: stop using `the_repository` (diff) | |
| download | git-7be9e410b22b3544e01d32f7bef8e6aa9516e152.tar.gz git-7be9e410b22b3544e01d32f7bef8e6aa9516e152.zip | |
commit-graph: stop passing in redundant repository
Many of the commit-graph related functions take in both a repository and
the object database source (directly or via `struct commit_graph`) for
which we are supposed to load such a commit-graph. In the best case this
information is simply redundant as the source already contains a
reference to its owning object database, which in turn has a reference
to its repository. In the worst case this information could even
mismatch when passing in a source that doesn't belong to the same
repository.
Refactor the code so that we only pass in the object database source in
those cases.
There is one exception though, namely `load_commit_graph_chain_fd_st()`,
which is responsible for loading a commit-graph chain. It is expected
that parts of the commit-graph chain aren't located in the same object
source as the chain file itself, but in a different one. Consequently,
this function doesn't work on the source level but on the database level
instead.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit-graph.c')
| -rw-r--r-- | builtin/commit-graph.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index f5c6f863a5..6656187f90 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -122,15 +122,15 @@ static int graph_verify(int argc, const char **argv, const char *prefix, if (opened == OPENED_NONE) return 0; else if (opened == OPENED_GRAPH) - graph = load_commit_graph_one_fd_st(the_repository, fd, &st, source); + graph = load_commit_graph_one_fd_st(source, fd, &st); else - graph = load_commit_graph_chain_fd_st(the_repository, fd, &st, + graph = load_commit_graph_chain_fd_st(the_repository->objects, fd, &st, &incomplete_chain); if (!graph) return 1; - ret = verify_commit_graph(the_repository, graph, flags); + ret = verify_commit_graph(graph, flags); free_commit_graph(graph); if (incomplete_chain) { |
