Code

cherry-pick: refactor commit parsing code
authorJeff King <peff@peff.net>
Thu, 11 Feb 2010 21:06:43 +0000 (16:06 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Feb 2010 06:11:01 +0000 (22:11 -0800)
These lines are really just lookup_commit_reference
re-implemented.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-revert.c

index 83e5c0a755846063a11e3c16432a3faa358d1359..012c64644d6ec0f0519721aa35b55c79e439ec81 100644 (file)
@@ -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)