diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-03 15:14:35 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-03 15:14:35 +0900 |
commit | e67f4b53f5881eede60f3d5975cbd04296afceca (patch) | |
tree | d71a8c1838cc192219c191fde10e2cd27f9dde9c /commit.c | |
parent | 701899296ca7dde6ba6c7e6fc54d79ab4a8df001 (diff) | |
download | git-e67f4b53f5881eede60f3d5975cbd04296afceca.tar.gz git-e67f4b53f5881eede60f3d5975cbd04296afceca.tar.bz2 git-e67f4b53f5881eede60f3d5975cbd04296afceca.zip |
Imported Upstream version 2.0.4upstream/2.0.4
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 25 |
1 files changed, 4 insertions, 21 deletions
@@ -18,19 +18,6 @@ int save_commit_buffer = 1; const char *commit_type = "commit"; -static struct commit *check_commit(struct object *obj, - const unsigned char *sha1, - int quiet) -{ - if (obj->type != OBJ_COMMIT) { - if (!quiet) - error("Object %s is a %s, not a commit", - sha1_to_hex(sha1), typename(obj->type)); - return NULL; - } - return (struct commit *) obj; -} - struct commit *lookup_commit_reference_gently(const unsigned char *sha1, int quiet) { @@ -38,7 +25,7 @@ struct commit *lookup_commit_reference_gently(const unsigned char *sha1, if (!obj) return NULL; - return check_commit(obj, sha1, quiet); + return object_as_type(obj, OBJ_COMMIT, quiet); } struct commit *lookup_commit_reference(const unsigned char *sha1) @@ -61,13 +48,9 @@ struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_n struct commit *lookup_commit(const unsigned char *sha1) { struct object *obj = lookup_object(sha1); - if (!obj) { - struct commit *c = alloc_commit_node(); - return create_object(sha1, OBJ_COMMIT, c); - } - if (!obj->type) - obj->type = OBJ_COMMIT; - return check_commit(obj, sha1, 0); + if (!obj) + return create_object(sha1, alloc_commit_node()); + return object_as_type(obj, OBJ_COMMIT, 0); } struct commit *lookup_commit_reference_by_name(const char *name) |