Git development
 help / color / mirror / Atom feed
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,  herroyalpriestess@gmail.com
Subject: Re: [Outreachy PATCH v4 1/3] parse-options: answer --git-completion-helper before command runs
Date: Thu, 05 Nov 2026 07:32:47 -0800	[thread overview]
Message-ID: <xmqq8q37xpi8.fsf@gitster.g> (raw)
In-Reply-To: <20261105003914.708836-1-tangajoris@gmail.com> (Tanga Joris's message of "Thu, 5 Nov 2026 03:39:11 +0300")

Tanga Joris <tangajoris@gmail.com> writes:

> diff --git a/parse-options.h b/parse-options.h
> index f68b51ceca..7ad33801fe 100644
> --- a/parse-options.h
> +++ b/parse-options.h
> @@ -427,6 +427,12 @@ int parse_options(int argc, const char **argv, const char *prefix,
>  NORETURN void usage_with_options(const char * const *usagestr,
>  				 const struct option *options);
>  
> +/*
> + * If the only argument is -h, --help-all, --git-completion-helper or
> + * --git-completion-helper-all, print the answer and exit. Call this
> + * before the command does any work. Then asking for help or for the
> + * completion list does not wait for input or leave files behind.
> + */

This is a very strange thing to say as a comment for this function.

There is no reason to expect any normal program to "wait for input"
or "leave files behind" unless the program has some strange trait.
What is it?

I think what you want to describe is

 - A program that uses parse_options() early in the program has no
   reason to use this function.

 - If there is a reason why you may have to react to help request
   from the command line before the control hits parse_options(),
   you may want to call this function to react to such a request.


"wait for input" and "leave files behind" are peculiarity that
exists only in fast-import, that is shared with nobody else, no?
The fact that it does not call parse_options() until it gets an
input, and that you want it to react to "-h", is what makes this
function useful in that context.

      parent reply	other threads:[~2026-11-05 15:32 UTC|newest]

Thread overview: 19+ 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   ` [Outreachy PATCH v2 1/2] fast-import: handle --git-completion-helper before reading input Junio C Hamano
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
2026-10-30 10:21       ` Kaartic Sivaraam
2026-11-02  2:26         ` Tanga Joris
2026-10-30  9:44     ` [Outreachy PATCH v3 1/2] parse-options: answer --git-completion-helper before command runs Kaartic Sivaraam
2026-10-31 22:01       ` Tanga Joris
2026-11-03  9:25     ` Cynthia Uche
2026-11-04 22:34       ` Tanga Joris
2026-11-05  0:39     ` [Outreachy PATCH v4 1/3] " Tanga Joris
2026-11-05  0:39       ` [Outreachy PATCH v4 2/3] git.c: drop NO_PARSEOPT from builtins that use parse-options Tanga Joris
2026-11-05  0:39       ` [Outreachy PATCH v4 3/3] t0012: catch builtins that keep NO_PARSEOPT after conversion Tanga Joris
2026-11-05 15:32       ` Junio C Hamano [this message]

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=xmqq8q37xpi8.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=herroyalpriestess@gmail.com \
    --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