Re: [PATCH 1/4] git: pass in repo for RUN_SETUP_GENTLY
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 24, 2024, 17:58 UTC
- Message-ID
- <xmqqjzf1szl7.fsf@gitster.g>
- In-Reply-To
- <eceb2d835be7168081d6eeffbce57bba89b5f423.1727185364.git.gitgitgadget@gmail.com>
"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> From: John Cai <johncai86@gmail.com> > > commands that have RUN_SETUP_GENTLY potentially need a repository. > Modify the logic in run_builtin() to pass the repository to the builtin > if a builtin has the RUN_SETUP_GENTLY property.
Ah, I remember mentioning this as a potiential future direction while reviewing the other series that added the repository argument to the cmd_foo() interface.
Nice to see the idea getting followed up.
Let's see how [Patches 2-4/4] can make effective use of this.
Show 21 quoted lines
> Signed-off-by: John Cai <johncai86@gmail.com> > --- > git.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/git.c b/git.c > index 2fbea24ec92..e31b52dcc50 100644 > --- a/git.c > +++ b/git.c > @@ -480,7 +480,10 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct > trace2_cmd_name(p->cmd); > > validate_cache_entries(repo->index); > - status = p->fn(argc, argv, prefix, (p->option & RUN_SETUP)? repo : NULL); > + status = p->fn(argc, > + argv, > + prefix, > + ((p->option & RUN_SETUP) || (p->option & RUN_SETUP_GENTLY))? repo : NULL); > validate_cache_entries(repo->index); > > if (status)