From: Junio C Hamano <gitster@pobox.com>
To: Tanga Joris <tangajoris@gmail.com>
Cc: git@vger.kernel.org, l.s.r@web.de, christian.couder@gmail.com,
siddharthasthana31@gmail.com, kaartic.sivaraam@gmail.com,
usmanakinyemi202@gmail.com
Subject: Re: [Outreachy PATCH v2 1/2] fast-import: handle --git-completion-helper before reading input
Date: Thu, 29 Oct 2026 11:04:46 -0700 [thread overview]
Message-ID: <xmqqy0bg2xj5.fsf@gitster.g> (raw)
In-Reply-To: <20261029012616.139783-1-tangajoris@gmail.com> (Tanga Joris's message of "Thu, 29 Oct 2026 04:26:15 +0300")
Tanga Joris <tangajoris@gmail.com> writes:
> diff --git a/builtin/fast-import.c b/builtin/fast-import.c
> index 9db3f83eea..f53113d5a5 100644
> --- a/builtin/fast-import.c
> +++ b/builtin/fast-import.c
> @@ -4204,6 +4204,10 @@ int cmd_fast_import(int argc,
> };
>
> show_usage_with_options_if_asked(argc, argv, fast_import_usage, fast_import_options);
> + if (argc == 2 && (!strcmp(argv[1], "--git-completion-helper") ||
> + !strcmp(argv[1], "--git-completion-helper-all")))
> + parse_options(argc, argv, prefix, fast_import_options,
> + fast_import_usage, 0);
>
> fast_import_state_init(&state, argc, argv, prefix, fast_import_options);
It is way too ugly to target this so specifically.
I wonder if we can teach show_usage_with_options_if_asked() to do
this? With this, and the above reverted, the new test added to
t9300 in this patch seems to pass.
parse-options.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git c/parse-options.c w/parse-options.c
index 283a0f1dc2..f2a23b79a4 100644
--- c/parse-options.c
+++ w/parse-options.c
@@ -1536,6 +1536,12 @@ void show_usage_with_options_if_asked(int ac, const char **av,
usage_with_options_internal(NULL, usagestr, opts,
USAGE_FULL, USAGE_TO_STDOUT);
exit(0);
+ } else if (!strcmp(av[1], "--git-completion-helper")) {
+ show_gitcomp(opts, 0);
+ exit(0);
+ } else if (!strcmp(av[1], "--git-completion-helper-all")) {
+ show_gitcomp(opts, 1);
+ exit(0);
}
}
}
next prev parent reply other threads:[~2026-10-29 18:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 5:24 [Outreachy PATCH] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
2026-10-25 7:59 ` René Scharfe
2026-10-26 2:59 ` Tanga Joris
2026-10-26 4:58 ` Junio C Hamano
2026-10-29 1:26 ` [Outreachy PATCH v2 1/2] fast-import: handle --git-completion-helper before reading input Tanga Joris
2026-10-29 1:26 ` [Outreachy PATCH v2 2/2] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
2026-10-29 18:04 ` Junio C Hamano [this message]
2026-10-29 23:16 ` [Outreachy PATCH v3 1/2] parse-options: answer --git-completion-helper before command runs Tanga Joris
2026-10-29 23:16 ` [Outreachy PATCH v3 2/2] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqy0bg2xj5.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=kaartic.sivaraam@gmail.com \
--cc=l.s.r@web.de \
--cc=siddharthasthana31@gmail.com \
--cc=tangajoris@gmail.com \
--cc=usmanakinyemi202@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox