Re: [PATCH v5 02/10] add--helper: create builtin helper for interactive add
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 21, 2019, 17:56 UTC
- Message-ID
- <xmqqzhqpt483.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <304c3863b123e08536412019e881967bf01dc4a4.1550662887.git.gitgitgadget@gmail.com>
"Daniel Ferreira via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 12 quoted lines
> diff --git a/git.c b/git.c
> index 2dd588674f..cb42591f37 100644
> --- a/git.c
> +++ b/git.c
> @@ -444,6 +444,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
>
> static struct cmd_struct commands[] = {
> { "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
> + { "add--helper", cmd_add__helper, RUN_SETUP | NEED_WORK_TREE },
> { "am", cmd_am, RUN_SETUP | NEED_WORK_TREE },
> { "annotate", cmd_annotate, RUN_SETUP | NO_PARSEOPT },
> { "apply", cmd_apply, RUN_SETUP_GENTLY },When adding a more complex replacement command we often cannot write RUN_SETUP nor NEED_WORK_TREE here and instead do the job ourselves in cmd_ourcommand() the hard way. But because this one is only for helping "add -i", we can let the git.c::run_builtin() aka "git potty" do the hard part, which is very nice.
Makes sense so far.
Thanks.