git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [GSoC] parse: not show usage help when invalid id
@ 2018-03-16 22:33 Roger Solano
  2018-03-16 23:05 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Solano @ 2018-03-16 22:33 UTC (permalink / raw)
  To: git; +Cc: Roger Solano

patch for too chatty command when <id> is invalid
ex. git tag --contains <id>

It is possible to skip 'goto show_usage_error' when
parse_long_opt fails? and return directly from there.

Signed-off-by: Roger Solano <sc_rogeralberto@hotmail.com>
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parse-options.c b/parse-options.c
index 125e84f98..074915eb3 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -550,7 +550,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 			goto show_usage;
 		switch (parse_long_opt(ctx, arg + 2, options)) {
 		case -1:
-			goto show_usage_error;
+			return -1; 
 		case -2:
 			goto unknown;
 		}
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [GSoC] parse: not show usage help when invalid id
  2018-03-16 22:33 [GSoC] parse: not show usage help when invalid id Roger Solano
@ 2018-03-16 23:05 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2018-03-16 23:05 UTC (permalink / raw)
  To: Roger Solano; +Cc: git, Roger Solano

Roger Solano <sroger.git@gmail.com> writes:

> patch for too chatty command when <id> is invalid
> ex. git tag --contains <id>
>
> It is possible to skip 'goto show_usage_error' when
> parse_long_opt fails? and return directly from there.

Can you explain how this relates to and/or compares with a recent
update [1]?

Thanks.

[1] https://public-inbox.org/git/20180306193116.23876-1-ungureanupaulsebastian@gmail.com

>
> Signed-off-by: Roger Solano <sc_rogeralberto@hotmail.com>
> ---
>  parse-options.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/parse-options.c b/parse-options.c
> index 125e84f98..074915eb3 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -550,7 +550,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  			goto show_usage;
>  		switch (parse_long_opt(ctx, arg + 2, options)) {
>  		case -1:
> -			goto show_usage_error;
> +			return -1; 
>  		case -2:
>  			goto unknown;
>  		}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-16 23:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 22:33 [GSoC] parse: not show usage help when invalid id Roger Solano
2018-03-16 23:05 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).