Skip to content

Commit

Permalink
commit-graph: create local repository pointer
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
derrickstolee authored and gitster committed Feb 25, 2021
1 parent c4ff24b commit c7ef8fe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions commit-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -2155,23 +2155,24 @@ int write_commit_graph(struct object_directory *odb,
enum commit_graph_write_flags flags,
const struct commit_graph_opts *opts)
{
struct repository *r = the_repository;
struct write_commit_graph_context *ctx;
uint32_t i;
int res = 0;
int replace = 0;
struct bloom_filter_settings bloom_settings = DEFAULT_BLOOM_FILTER_SETTINGS;
struct topo_level_slab topo_levels;

prepare_repo_settings(the_repository);
if (!the_repository->settings.core_commit_graph) {
prepare_repo_settings(r);
if (!r->settings.core_commit_graph) {
warning(_("attempting to write a commit-graph, but 'core.commitGraph' is disabled"));
return 0;
}
if (!commit_graph_compatible(the_repository))
if (!commit_graph_compatible(r))
return 0;

ctx = xcalloc(1, sizeof(struct write_commit_graph_context));
ctx->r = the_repository;
ctx->r = r;
ctx->odb = odb;
ctx->append = flags & COMMIT_GRAPH_WRITE_APPEND ? 1 : 0;
ctx->report_progress = flags & COMMIT_GRAPH_WRITE_PROGRESS ? 1 : 0;
Expand Down

0 comments on commit c7ef8fe

Please sign in to comment.