object: add repository argument to parse_object_buffer

Add a repository argument to allow the callers of parse_object_buffer
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

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>
This commit is contained in:
Stefan Beller
2018-06-28 18:21:53 -07:00
committed by Junio C Hamano
parent 5abddd1eb7
commit 1ec5bfd24e
7 changed files with 18 additions and 9 deletions

View File

@ -186,7 +186,7 @@ struct object *lookup_unknown_object(const unsigned char *sha1)
return obj;
}
struct object *parse_object_buffer(const struct object_id *oid, enum object_type type, unsigned long size, void *buffer, int *eaten_p)
struct object *parse_object_buffer_the_repository(const struct object_id *oid, enum object_type type, unsigned long size, void *buffer, int *eaten_p)
{
struct object *obj;
*eaten_p = 0;
@ -278,7 +278,8 @@ struct object *parse_object_the_repository(const struct object_id *oid)
return NULL;
}
obj = parse_object_buffer(oid, type, size, buffer, &eaten);
obj = parse_object_buffer(the_repository, oid, type, size,
buffer, &eaten);
if (!eaten)
free(buffer);
return obj;