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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These lines are really just lookup_commit_reference
re-implemented.

Signed-off-by: Jeff King <peff@xxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]