commit-graph: create local repository pointer
The write_commit_graph() method uses 'the_repository' in a few places. A new need for a repository pointer is coming in the following change, so group these instances into a local variable 'r' that could eventually become part of the method signature, if so desired. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Feb 25, 2021 at 18:19 UTC
c7ef8fe608819f05526408c741719589599a544a
1 file changed
+5
-4
commit-graph.c
+5
-4
@@ -2155,6 +2155,7 @@ int write_commit_graph(struct object_directory *odb,
2155
enum commit_graph_write_flags flags,
2156
const struct commit_graph_opts *opts)
2157
{
2158
+ struct repository *r = the_repository;
2159
struct write_commit_graph_context *ctx;
2160
uint32_t i;
2161
int res = 0;
@@ -2162,16 +2163,16 @@ int write_commit_graph(struct object_directory *odb,
2163
struct bloom_filter_settings bloom_settings = DEFAULT_BLOOM_FILTER_SETTINGS;
2164
struct topo_level_slab topo_levels;
2165
2165
- prepare_repo_settings(the_repository);
2166
- if (!the_repository->settings.core_commit_graph) {
2166
+ prepare_repo_settings(r);
2167
+ if (!r->settings.core_commit_graph) {
2168
warning(_("attempting to write a commit-graph, but 'core.commitGraph' is disabled"));
2169
return 0;
2170
}
2170
- if (!commit_graph_compatible(the_repository))
2171
+ if (!commit_graph_compatible(r))
2172
return 0;
2173
2174
ctx = xcalloc(1, sizeof(struct write_commit_graph_context));
2174
- ctx->r = the_repository;
2175
+ ctx->r = r;
2176
ctx->odb = odb;
2177
ctx->append = flags & COMMIT_GRAPH_WRITE_APPEND ? 1 : 0;
2178
ctx->report_progress = flags & COMMIT_GRAPH_WRITE_PROGRESS ? 1 : 0;