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

[PATCH/GSoC 3/3] Nousage message in error

From
DJDiwas Joshi <dj.dij123@gmail.com>
Date
Mar 24, 2016, 02:03 UTC
Message-ID
<1458785018-29232-1-git-send-email-dj.dij123@gmail.com>
- To show only error text instead of full usage message
- Adds exits to callback function in parse-options-cb.c instead of returning -1 which results in display of usage message.
---
 parse-options-cb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 239898d..b7321d1 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -85,8 +85,10 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset)
 
 	if (!arg)
 		return -1;
-	if (get_sha1(arg, sha1))
-		return error("malformed object name %s", arg);
+	if (get_sha1(arg, sha1)) {
+		error("malformed object name %s", arg);
+		exit(129);
+	}
 	commit = lookup_commit_reference(sha1);
 	if (!commit)
 		return error("no such commit %s", arg);
-- 
2.7.4
Next: Pranit Bauva
Message 1 of 5 in “Nousage message in error”
  1. 3/3 Nousage message in errorDiwas Joshi, Mar 24, 2016
  2. Pranit BauvaMar 24, 2016
  3. Junio C HamanoMar 24, 2016
  4. Pranit BauvaMar 24, 2016
  5. Pranit BauvaMar 24, 2016

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.