@matheusbsbs / matheus-bagliano / commits / dd9314cc2a
Fork 0

cherry-pick: refactor commit parsing code

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>

Jeff King committed Feb 11, 2010 at 16:06 UTC dd9314cc2a2f353bf9438db14cbbf02a1c219bda
1 file changed +2 -8
builtin-revert.c
+2 -8
@@ -68,15 +68,9 @@ static void parse_args(int argc, const char **argv)
68
69 if (get_sha1(arg, sha1))
70 die ("Cannot find '%s'", arg);
71 - commit = (struct commit *)parse_object(sha1);
71 + commit = lookup_commit_reference(sha1);
72 if (!commit)
73 - die ("Could not find %s", sha1_to_hex(sha1));
74 - if (commit->object.type == OBJ_TAG) {
75 - commit = (struct commit *)
76 - deref_tag((struct object *)commit, arg, strlen(arg));
77 - }
78 - if (commit->object.type != OBJ_COMMIT)
79 - die ("'%s' does not point to a commit", arg);
73 + exit(1);
74 }
75
76 static char *get_oneline(const char *message)