Jeff King <peff@xxxxxxxx> writes: > On Fri, Oct 14, 2022 at 11:40:27AM -0700, Junio C Hamano wrote: > >> > @@ -862,11 +858,11 @@ static void write_refspec_config(const char *src_ref_prefix, >> > >> > static void dissociate_from_references(void) >> > { >> > - static const char* argv[] = { "repack", "-a", "-d", NULL }; >> >> Good to see that this one in a wrong scope can now go away. > > It definitely is broader scope than is necessary. I wonder if it makes > things easier to read, though, the way we would sometimes hoist things > out of a function into a static-global to make them more obvious. I > dunno. Didn't think about it, but it is a worthy point to make. Unlike the call to l_opt() buried inside a conditional, it makes it stand out that what we see upfront is one of the commands the function will run. It is especially valuable when a function is almost exclusively about running a single command, but then we will have a single call to l_opt() without much preparations or clean-ups around it, so the visual noise that detracts our eyes away from the actual commands may not be all that bad, though. >> > char *alternates = git_pathdup("objects/info/alternates"); >> > >> > if (!access(alternates, F_OK)) { >> > - if (run_command_v_opt(argv, RUN_GIT_CMD|RUN_COMMAND_NO_STDIN)) >> > + if (run_command_l_opt(RUN_GIT_CMD|RUN_COMMAND_NO_STDIN, >> > + "repack", "-a", "-d", NULL)) >> > die(_("cannot repack to clean up")); > > I just happened to notice in this one there is a weird extra space > before "-a". Yeah, good eyes. Thanks.