From: Jeff King Date: Thu, 11 Feb 2010 21:06:43 +0000 (-0500) Subject: cherry-pick: refactor commit parsing code X-Git-Tag: v1.7.0.1~16^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dd9314cc2a2f353bf9438db14cbbf02a1c219bda;p=git.git cherry-pick: refactor commit parsing code These lines are really just lookup_commit_reference re-implemented. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/builtin-revert.c b/builtin-revert.c index 83e5c0a75..012c64644 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)