Skip to content

Commit 341e45e

Browse files
stefanbellergitster
authored andcommitted
object: allow create_object to handle arbitrary repositories
Reviewed-by: Jonathan Tan <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 346a817 commit 341e45e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

object.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,20 @@ static void grow_object_hash(struct repository *r)
139139
r->parsed_objects->obj_hash_size = new_hash_size;
140140
}
141141

142-
void *create_object_the_repository(const unsigned char *sha1, void *o)
142+
void *create_object(struct repository *r, const unsigned char *sha1, void *o)
143143
{
144144
struct object *obj = o;
145145

146146
obj->parsed = 0;
147147
obj->flags = 0;
148148
hashcpy(obj->oid.hash, sha1);
149149

150-
if (the_repository->parsed_objects->obj_hash_size - 1 <= the_repository->parsed_objects->nr_objs * 2)
151-
grow_object_hash(the_repository);
150+
if (r->parsed_objects->obj_hash_size - 1 <= r->parsed_objects->nr_objs * 2)
151+
grow_object_hash(r);
152152

153-
insert_obj_hash(obj, the_repository->parsed_objects->obj_hash,
154-
the_repository->parsed_objects->obj_hash_size);
155-
the_repository->parsed_objects->nr_objs++;
153+
insert_obj_hash(obj, r->parsed_objects->obj_hash,
154+
r->parsed_objects->obj_hash_size);
155+
r->parsed_objects->nr_objs++;
156156
return obj;
157157
}
158158

object.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ extern struct object *get_indexed_object(unsigned int);
9393
*/
9494
struct object *lookup_object(const unsigned char *sha1);
9595

96-
#define create_object(r, s, o) create_object_##r(s, o)
97-
extern void *create_object_the_repository(const unsigned char *sha1, void *obj);
96+
extern void *create_object(struct repository *r, const unsigned char *sha1, void *obj);
9897

9998
void *object_as_type(struct object *obj, enum object_type type, int quiet);
10099

0 commit comments

Comments
 (0)