Skip to content

Commit c7ef8fe

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c4ff24b commit c7ef8fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

commit-graph.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,23 +2155,24 @@ int write_commit_graph(struct object_directory *odb,
21552155
enum commit_graph_write_flags flags,
21562156
const struct commit_graph_opts *opts)
21572157
{
2158+
struct repository *r = the_repository;
21582159
struct write_commit_graph_context *ctx;
21592160
uint32_t i;
21602161
int res = 0;
21612162
int replace = 0;
21622163
struct bloom_filter_settings bloom_settings = DEFAULT_BLOOM_FILTER_SETTINGS;
21632164
struct topo_level_slab topo_levels;
21642165

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) {
21672168
warning(_("attempting to write a commit-graph, but 'core.commitGraph' is disabled"));
21682169
return 0;
21692170
}
2170-
if (!commit_graph_compatible(the_repository))
2171+
if (!commit_graph_compatible(r))
21712172
return 0;
21722173

21732174
ctx = xcalloc(1, sizeof(struct write_commit_graph_context));
2174-
ctx->r = the_repository;
2175+
ctx->r = r;
21752176
ctx->odb = odb;
21762177
ctx->append = flags & COMMIT_GRAPH_WRITE_APPEND ? 1 : 0;
21772178
ctx->report_progress = flags & COMMIT_GRAPH_WRITE_PROGRESS ? 1 : 0;

0 commit comments

Comments
 (0)