Re: [PATCH 03/10] run-command API: add and use a run_command_l_opt()
- From
Jeff King <peff@peff.net>
- Date
- Oct 14, 2022, 20:03 UTC
- Message-ID
- <Y0nAm4+KL71vyYB8@coredump.intra.peff.net>
- In-Reply-To
- <xmqqtu468d0k.fsf@gitster.g>
On Fri, Oct 14, 2022 at 11:40:27AM -0700, Junio C Hamano wrote:
Show 7 quoted lines
> > @@ -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.
Show 7 quoted lines
> > 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".
-Peff