X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=tree.c;h=64422fd27e3f855b7989bc8cb9a6a0ada7a30472;hp=9bbe2da37b24007b6409d5e1e5c61a20d0903628;hb=HEAD;hpb=75c3a5ccdf114b5485e4828db1923bf4a35b19e2 diff --git a/tree.c b/tree.c index 9bbe2da3..64422fd2 100644 --- a/tree.c +++ b/tree.c @@ -131,14 +131,14 @@ struct tree *lookup_tree(const unsigned char *sha1) if (!obj) { struct tree *ret = xcalloc(1, sizeof(struct tree)); created_object(sha1, &ret->object); - ret->object.type = tree_type; + ret->object.type = TYPE_TREE; return ret; } if (!obj->type) - obj->type = tree_type; - if (obj->type != tree_type) { - error("Object %s is a %s, not a tree", - sha1_to_hex(sha1), obj->type); + obj->type = TYPE_TREE; + if (obj->type != TYPE_TREE) { + error("Object %s is a %s, not a tree", + sha1_to_hex(sha1), typename(obj->type)); return NULL; } return (struct tree *) obj; @@ -216,11 +216,11 @@ struct tree *parse_tree_indirect(const unsigned char *sha1) do { if (!obj) return NULL; - if (obj->type == tree_type) + if (obj->type == TYPE_TREE) return (struct tree *) obj; - else if (obj->type == commit_type) + else if (obj->type == TYPE_COMMIT) obj = &(((struct commit *) obj)->tree->object); - else if (obj->type == tag_type) + else if (obj->type == TYPE_TAG) obj = ((struct tag *) obj)->tagged; else return NULL;