提交 a962da1e 编写于 作者: S Stefan Beller 提交者: Junio C Hamano

object: allow object_as_type to handle arbitrary repositories

Signed-off-by: NStefan Beller <sbeller@google.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 a74093da
......@@ -158,13 +158,13 @@ void *create_object(struct repository *r, const unsigned char *sha1, void *o)
return obj;
}
void *object_as_type_the_repository(struct object *obj, enum object_type type, int quiet)
void *object_as_type(struct repository *r, struct object *obj, enum object_type type, int quiet)
{
if (obj->type == type)
return obj;
else if (obj->type == OBJ_NONE) {
if (type == OBJ_COMMIT)
((struct commit *)obj)->index = alloc_commit_index(the_repository);
((struct commit *)obj)->index = alloc_commit_index(r);
obj->type = type;
return obj;
}
......
......@@ -114,8 +114,7 @@ struct object *lookup_object_the_repository(const unsigned char *sha1);
extern void *create_object(struct repository *r, const unsigned char *sha1, void *obj);
#define object_as_type(r, o, t, q) object_as_type_##r(o, t, q)
void *object_as_type_the_repository(struct object *obj, enum object_type type, int quiet);
void *object_as_type(struct repository *r, struct object *obj, enum object_type type, int quiet);
/*
* Returns the object, having parsed it to find out what it is.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册