blob: allow lookup_blob to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Jun 28, 2018 at 18:22 UTC
17126cdf78dc7b8cbe6b35bc44cb74d8d0fb11ee
2 files changed
+6
-7
blob.c
+5
-5
@@ -5,13 +5,13 @@
5
6
const char *blob_type = "blob";
7
8
-struct blob *lookup_blob_the_repository(const struct object_id *oid)
8
+struct blob *lookup_blob(struct repository *r, const struct object_id *oid)
9
{
10
- struct object *obj = lookup_object(the_repository, oid->hash);
10
+ struct object *obj = lookup_object(r, oid->hash);
11
if (!obj)
12
- return create_object(the_repository, oid->hash,
13
- alloc_blob_node(the_repository));
14
- return object_as_type(the_repository, obj, OBJ_BLOB, 0);
12
+ return create_object(r, oid->hash,
13
+ alloc_blob_node(r));
14
+ return object_as_type(r, obj, OBJ_BLOB, 0);
15
}
16
17
int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
blob.h
+1
-2
@@ -9,8 +9,7 @@ struct blob {
9
struct object object;
10
};
11
12
-#define lookup_blob(r, o) lookup_blob_##r(o)
13
-struct blob *lookup_blob_the_repository(const struct object_id *oid);
12
+struct blob *lookup_blob(struct repository *r, const struct object_id *oid);
13
14
int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
15