Subject: Re: [PATCH] add-patch: response to invalid option

From: Rubén Justo <[email-masked]>
Date: Tue, 16 Apr 2024 21:31:18 +0200

On Tue, Apr 16, 2024 at 03:26:33AM -0700, Junio C Hamano wrote:

> > When the user introduces an invalid option, we respond with the whole
> > help text.
> 
> The verb "introduces" in the first sentence looked weird to me.

OK.  I'll reword it.

> > Instead of displaying the long help description, display a short error
> > message indicating the incorrectly introduced option with a note on how
> > to get the help text.

> Is it worth changing it at this point?  Does it improve the end-user
> experience in any noticeable way?  I do not think I can answer these
> two questions with confident "yes".

Indeed, this has been with us for a long time.  We're not fixing or
changing any normal usage here.

I know you know, but let me put it this way;  We are introducing two
changes here:

   - a new error message to inform the user that an invalid option has
     been entered.  And,

   - not displaying the help if not requested.

Both are improvements to the user experience, but especially the former,
I think.

This:

	$ echo W | git add -p 
	diff --git a/add-interactive.c b/add-interactive.c
	[...]
	(1/1) Stage this hunk [y,n,q,a,d,e,?]? y - stage this hunk
	n - do not stage this hunk
	q - quit; do not stage this hunk or any of the remaining ones
	a - stage this hunk and all later hunks in the file
	[...]

Becomes:

	$ echo W | ./git add -p
	diff --git a/add-interactive.c b/add-interactive.c
	[...]
	(1/1) Stage this hunk [y,n,q,a,d,e,p,?]? Unknown option 'W' (use '?' for help)

Thanks.