Skip to content

Commit

Permalink
cherry-pick: refactor commit parsing code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Feb 12, 2010
1 parent 6e35997 commit dd9314c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions builtin-revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dd9314c

Please sign in to comment.