From: Patrick Steinhardt Date: Fri, 23 Oct 2026 12:50:20 GMT Subject: [PATCH 3/7] rerere: remove redundant calls to `repo_config()` 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 --- 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