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

[PATCH 2/4] cherry-pick: refactor commit parsing code

From
Jeff King <peff@peff.net>
Date
Feb 11, 2010, 21:06 UTC
Message-ID
<20100211210642.GB9066@coredump.intra.peff.net>
In-Reply-To
<20100211210445.GA8819@coredump.intra.peff.net>

These lines are really just lookup_commit_reference re-implemented.

Signed-off-by: Jeff King <peff@peff.net>
---
Obviously this changes the exact text of the error messages, but I doubt
anybody cares too much.
 builtin-revert.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/builtin-revert.c b/builtin-revert.c
index 83e5c0a..012c646 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -68,15 +68,9 @@ static void parse_args(int argc, const char **argv)
 
 	if (get_sha1(arg, sha1))
 		die ("Cannot find '%s'", arg);
-	commit = (struct commit *)parse_object(sha1);
+	commit = lookup_commit_reference(sha1);
 	if (!commit)
-		die ("Could not find %s", sha1_to_hex(sha1));
-	if (commit->object.type == OBJ_TAG) {
-		commit = (struct commit *)
-			deref_tag((struct object *)commit, arg, strlen(arg));
-	}
-	if (commit->object.type != OBJ_COMMIT)
-		die ("'%s' does not point to a commit", arg);
+		exit(1);
 }
 
 static char *get_oneline(const char *message)
-- 
1.7.0.rc2.40.g33ed2.dirty
Previous: Jeff KingNext: Jeff King
Message 12 of 22 in “git cherry-pick --continue?”
  1. Sverre RabbelierFeb 10, 2010
  2. Jeff KingFeb 10, 2010
  3. Jeff KingFeb 10, 2010
  4. Sverre RabbelierFeb 10, 2010
  5. Junio C HamanoFeb 10, 2010
  6. Junio C HamanoFeb 10, 2010
  7. Sverre RabbelierFeb 10, 2010
  8. Junio C HamanoFeb 10, 2010
  9. Sverre RabbelierFeb 10, 2010
  10. Jeff KingFeb 11, 2010
  11. 1/4 cherry-pick: rewrap advice messageJeff King, Feb 11, 2010
  12. 2/4 cherry-pick: refactor commit parsing codeJeff King, Feb 11, 2010
  13. 3/4 cherry-pick: format help message as strbufJeff King, Feb 11, 2010
  14. 4/4 cherry-pick: show commit name instead of sha1Jeff King, Feb 11, 2010
  15. Jeff KingFeb 11, 2010
  16. Jay SoffianFeb 11, 2010
  17. Junio C HamanoFeb 11, 2010
  18. Jeff KingFeb 11, 2010
  19. Jeff KingFeb 11, 2010
  20. Junio C HamanoFeb 11, 2010
  21. Jeff KingFeb 11, 2010
  22. SZEDER GáborFeb 12, 2010

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.