diff options
author | Junio C Hamano <junkio@cox.net> | 2005-08-23 00:07:17 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-08-23 00:07:17 -0700 |
commit | 89305da8a230e435109cc97ed88241c158813523 (patch) | |
tree | 099925d87bdb82a735df5f857a724e3e067ac40b /commit.c | |
parent | 15ac5164427d838d9377643dcdd03edd770cf001 (diff) | |
parent | f5e375c9a99d731c05eef701f119da85d62fc158 (diff) | |
download | git-89305da8a230e435109cc97ed88241c158813523.tar.gz |
Merge refs/heads/master from .
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -38,23 +38,32 @@ enum cmit_fmt get_commit_format(const char *arg) die("invalid --pretty format"); } -static struct commit *check_commit(struct object *obj, const unsigned char *sha1) +static struct commit *check_commit(struct object *obj, + const unsigned char *sha1, + int quiet) { if (obj->type != commit_type) { - error("Object %s is a %s, not a commit", - sha1_to_hex(sha1), obj->type); + if (!quiet) + error("Object %s is a %s, not a commit", + sha1_to_hex(sha1), obj->type); return NULL; } return (struct commit *) obj; } -struct commit *lookup_commit_reference(const unsigned char *sha1) +struct commit *lookup_commit_reference_gently(const unsigned char *sha1, + int quiet) { struct object *obj = deref_tag(parse_object(sha1)); if (!obj) return NULL; - return check_commit(obj, sha1); + return check_commit(obj, sha1, quiet); +} + +struct commit *lookup_commit_reference(const unsigned char *sha1) +{ + return lookup_commit_reference_gently(sha1, 0); } struct commit *lookup_commit(const unsigned char *sha1) @@ -69,7 +78,7 @@ struct commit *lookup_commit(const unsigned char *sha1) } if (!obj->type) obj->type = commit_type; - return check_commit(obj, sha1); + return check_commit(obj, sha1, 0); } static unsigned long parse_commit_date(const char *buf) |