Skip to content

Commit a962da1

Browse files
stefanbellergitster
authored andcommitted
object: allow object_as_type to handle arbitrary repositories
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a74093d commit a962da1

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ void *create_object(struct repository *r, const unsigned char *sha1, void *o)
158158
return obj;
159159
}
160160

161-
void *object_as_type_the_repository(struct object *obj, enum object_type type, int quiet)
161+
void *object_as_type(struct repository *r, struct object *obj, enum object_type type, int quiet)
162162
{
163163
if (obj->type == type)
164164
return obj;
165165
else if (obj->type == OBJ_NONE) {
166166
if (type == OBJ_COMMIT)
167-
((struct commit *)obj)->index = alloc_commit_index(the_repository);
167+
((struct commit *)obj)->index = alloc_commit_index(r);
168168
obj->type = type;
169169
return obj;
170170
}

object.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ struct object *lookup_object_the_repository(const unsigned char *sha1);
114114

115115
extern void *create_object(struct repository *r, const unsigned char *sha1, void *obj);
116116

117-
#define object_as_type(r, o, t, q) object_as_type_##r(o, t, q)
118-
void *object_as_type_the_repository(struct object *obj, enum object_type type, int quiet);
117+
void *object_as_type(struct repository *r, struct object *obj, enum object_type type, int quiet);
119118

120119
/*
121120
* Returns the object, having parsed it to find out what it is.

0 commit comments

Comments
 (0)