git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] commit-graph: create local repository pointer

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 25, 2021, 18:19 UTC
Message-ID
<29b4ac5594dd039ee76f9f1b8630f13482aaa8f9.1614277183.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.886.git.1614277183.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>

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>
---
 commit-graph.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/commit-graph.c b/commit-graph.c
index b9efeddeab6c..8b07a9a0a6df 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2155,6 +2155,7 @@ 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;
@@ -2162,16 +2163,16 @@ int write_commit_graph(struct object_directory *odb,
 	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;
-- 
gitgitgadget
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee via GitGitGadget
Message 2 of 3 in “Specify generation number version by config”
  1. 0/2 Specify generation number version by configDerrick Stolee via GitGitGadget, Feb 25, 2021
  2. 1/2 commit-graph: create local repository pointerDerrick Stolee via GitGitGadget, Feb 25, 2021
  3. 2/2 commit-graph: use config to specify generation typeDerrick Stolee via GitGitGadget, Feb 25, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.