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

[PATCH 3/7] rerere: remove redundant calls to `repo_config()`

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 23, 2026, 12:50 UTC
Message-ID
<20261023-pks-rerere-wo-the-repository-v1-3-b6ac0c2e4b81@pks.im>
In-Reply-To
<20261023-pks-rerere-wo-the-repository-v1-0-b6ac0c2e4b81@pks.im>

When setting up the rerere cache we eventually end up calling `repo_config()`. This call is redundant though, as all callers of `setup_rerere()` already called `repo_config()` beforehand.

Next to being redundant though it also feels like a layering violation. The intent of that function is to set up state for the rerere cache, but we potentially end up modifying other global state, too. This is usually fine, but it is surprising to say the very least. If a caller for example were to call `repo_config()` and then modifies the parsed config manually then those modifications would be lost when calling `setup_rerere()`.

Despite the layering violation though it will also create problems with a subsequent commit, where we are about to cache whether or not the rerere cache is enabled. As part of that change we would stop calling `repo_config()` when the rerere cache is disabled, but continue to call it when it's enabled. So the above layering violation is essentially becoming even worse, because we may or may not clobber config values.

Drop the call, as well as another redundant call in `rerere_gc()`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 rerere.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rerere.c b/rerere.c
index c568bd5e89..56b6ef547b 100644
--- a/rerere.c
+++ b/rerere.c
@@ -878,7 +878,6 @@ static void git_rerere_config(struct repository *r)
 	repo_config_get_bool(r, "rerere.enabled", &rerere_enabled);
 	repo_config_get_bool(r, "rerere.autoupdate", &rerere_autoupdate);
 	repo_config_get_int(r, "rerere.locktimeout", &rerere_lock_timeout_ms);
-	repo_config(r, git_default_config, NULL);
 }
 
 static GIT_PATH_FUNC(git_path_rr_cache, "rr-cache")
@@ -1333,7 +1332,7 @@ void rerere_gc(struct repository *r, struct string_list *rr, int flags)
 		return;
 
 	rerere_gc_cutoffs(r, &cutoff_resolve, &cutoff_noresolve);
-	repo_config(r, git_default_config, NULL);
+
 	dir = opendir(repo_git_path_replace(r, &buf, "rr-cache"));
 	if (!dir)
 		die_errno(_("unable to open rr-cache directory"));
-- 
2.56.0.307.g5fe7bd680c.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 4 of 10 in “rerere: remove global state”
  1. 0/7 rerere: remove global statePatrick Steinhardt, Oct 23, 2026
  2. 1/7 rerere: stop using `the_repository` in `rerere_path()`Patrick Steinhardt, Oct 23, 2026
  3. 2/7 rerere: stop using `the_repository` in internal helpersPatrick Steinhardt, Oct 23, 2026
  4. 3/7 rerere: remove redundant calls to `repo_config()`Patrick Steinhardt, Oct 23, 2026
  5. 4/7 rerere: cache result of `is_rerere_enabled()`Patrick Steinhardt, Oct 23, 2026
  6. 5/7 rerere: stop using `the_repository`Patrick Steinhardt, Oct 23, 2026
  7. 6/7 rerere: bundle global state into a structPatrick Steinhardt, Oct 23, 2026
  8. 7/7 rerere: get rid of global rerere cache statePatrick Steinhardt, Oct 23, 2026
  9. Junio C HamanoOct 23, 2026
  10. Patrick SteinhardtOct 26, 2026

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.