From: Patrick Steinhardt Date: Tue, 24 Feb 2026 09:18:38 GMT Subject: Re: [PATCH 1/2] for-each-repo: stop using the_repository Message-ID: In-Reply-To: <86cd83f65b30aab3233e27b3e5c4f03041e68766.1771903950.git.gitgitgadget@gmail.com> On Tue, Feb 24, 2026 at 03:32:29AM +0000, Derrick Stolee via GitGitGadget wrote: > diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c > index 325a7925f1..478ccf1287 100644 > --- a/builtin/for-each-repo.c > +++ b/builtin/for-each-repo.c > @@ -1,5 +1,3 @@ > -#define USE_THE_REPOSITORY_VARIABLE > - > #include "builtin.h" > #include "config.h" > #include "gettext.h" > @@ -33,7 +31,7 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv) > int cmd_for_each_repo(int argc, > const char **argv, > const char *prefix, > - struct repository *repo UNUSED) > + struct repository *repo) > { > static const char *config_key = NULL; > int keep_going = 0; > @@ -55,7 +53,7 @@ int cmd_for_each_repo(int argc, > if (!config_key) > die(_("missing --config=")); > > - err = repo_config_get_string_multi(the_repository, config_key, &values); > + err = repo_config_get_string_multi(repo, config_key, &values); > if (err < 0) > usage_msg_optf(_("got bad config --config=%s"), > for_each_repo_usage, options, config_key); The command is marked as `RUN_SETUP_GENTLY`, so it may run in a context where there is no repository. In such cases, `repo` would be `NULL`, and that would cause the command to segfault here, wouldn't it? Patrick