Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
object: allow create_object to handle arbitrary repositories
author
Stefan Beller
<sbeller@google.com>
Tue, 8 May 2018 19:37:35 +0000
(12:37 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 9 May 2018 03:12:37 +0000
(12:12 +0900)
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object.c
patch
|
blob
|
history
object.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
346a817
)
diff --git
a/object.c
b/object.c
index 0fcd6f6df42d73934c2fdeaabafd06c18bbbbcf9..49b952e92997e3444e126814472828220af1ea0a 100644
(file)
--- a/
object.c
+++ b/
object.c
@@
-139,7
+139,7
@@
static void grow_object_hash(struct repository *r)
r->parsed_objects->obj_hash_size = new_hash_size;
}
r->parsed_objects->obj_hash_size = new_hash_size;
}
-void *create_object
_the_repository(
const unsigned char *sha1, void *o)
+void *create_object
(struct repository *r,
const unsigned char *sha1, void *o)
{
struct object *obj = o;
{
struct object *obj = o;
@@
-147,12
+147,12
@@
void *create_object_the_repository(const unsigned char *sha1, void *o)
obj->flags = 0;
hashcpy(obj->oid.hash, sha1);
obj->flags = 0;
hashcpy(obj->oid.hash, sha1);
- if (
the_repository->parsed_objects->obj_hash_size - 1 <= the_repository
->parsed_objects->nr_objs * 2)
- grow_object_hash(
the_repository
);
+ if (
r->parsed_objects->obj_hash_size - 1 <= r
->parsed_objects->nr_objs * 2)
+ grow_object_hash(
r
);
- insert_obj_hash(obj,
the_repository
->parsed_objects->obj_hash,
-
the_repository
->parsed_objects->obj_hash_size);
-
the_repository
->parsed_objects->nr_objs++;
+ insert_obj_hash(obj,
r
->parsed_objects->obj_hash,
+
r
->parsed_objects->obj_hash_size);
+
r
->parsed_objects->nr_objs++;
return obj;
}
return obj;
}
diff --git
a/object.h
b/object.h
index 2cb0b2410839a27191402a36f560bb24be86190e..b41d7a3accbab8c7928cecf35658a9bcadac6a7e 100644
(file)
--- a/
object.h
+++ b/
object.h
@@
-93,8
+93,7
@@
extern struct object *get_indexed_object(unsigned int);
*/
struct object *lookup_object(const unsigned char *sha1);
*/
struct object *lookup_object(const unsigned char *sha1);
-#define create_object(r, s, o) create_object_##r(s, o)
-extern void *create_object_the_repository(const unsigned char *sha1, void *obj);
+extern void *create_object(struct repository *r, const unsigned char *sha1, void *obj);
void *object_as_type(struct object *obj, enum object_type type, int quiet);
void *object_as_type(struct object *obj, enum object_type type, int quiet);