git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GSoC] parse: not show usage help when invalid id

From
RSRoger Solano <sroger.git@gmail.com>
Date
Mar 16, 2018, 22:33 UTC
Message-ID
<20180316223345.7799-1-sc_rogeralberto@hotmail.com>

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
Next: Junio C Hamano
Message 1 of 2 in “[GSoC] parse: not show usage help when invalid id”
  1. Roger SolanoMar 16, 2018
  2. Junio C HamanoMar 16, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.