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

[PATCH] clarify error message when an abbreviated non-existent commit was specified

From
Tim Harper <timcharper@gmail.com>
Date
Aug 6, 2009, 19:53 UTC
Message-ID
<1249588435-23400-1-git-send-email-timcharper@gmail.com>
In-Reply-To
<20090806193413.GJ1033@spearce.org>
When running the command 'git branch --contains efabdfb' on a repository that doesn't yet have efabdfb, git reports: "malformed object name efabdfb". To the uninitiated, this makes little sense (as far as they are concerned, efabdfb is perfectly formed).
This commit changes the message to "malformed object name or no such commit: efabdfb"
---
 parse-options.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index 3b71fbb..95eb1c4 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -615,7 +615,7 @@ int parse_opt_with_commit(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);
+		return error("malformed object name or no such commit: %s", arg);
 	commit = lookup_commit_reference(sha1);
 	if (!commit)
 		return error("no such commit %s", arg);
-- 
1.6.4
Previous: Shawn O. PearceNext: Tim Harper
Message 3 of 5 in “surprising error message in parse_opt_with_commit”
  1. Tim HarperAug 6, 2009
  2. Shawn O. PearceAug 6, 2009
  3. clarify error message when an abbreviated non-existent commit was specifiedTim Harper, Aug 6, 2009
  4. Tim HarperAug 7, 2009
  5. Junio C HamanoAug 7, 2009

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.