diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-10-01 11:16:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-02 00:06:00 +0200 |
commit | ddb3474b66ef36da40a4cf8346ec4655518243cb (patch) | |
tree | a5481b3cc606b3dd23728f6d9b476fade19d3adb /streaming.c | |
parent | object-file.c: return -1, not "status" from unpack_loose_header() (diff) | |
download | git-ddb3474b66ef36da40a4cf8346ec4655518243cb.tar.xz git-ddb3474b66ef36da40a4cf8346ec4655518243cb.zip |
object-file.c: make parse_loose_header_extended() public
Make the parse_loose_header_extended() function public and remove the
parse_loose_header() wrapper. The only direct user of it outside of
object-file.c itself was in streaming.c, that caller can simply pass
the required "struct object-info *" instead.
This change is being done in preparation for teaching
read_loose_object() to accept a flag to pass to
parse_loose_header(). It isn't strictly necessary for that change, we
could simply use parse_loose_header_extended() there, but will leave
the API in a better end state.
It would be a better end-state to have already moved the declaration
of these functions to object-store.h to avoid the forward declaration
of "struct object_info" in cache.h, but let's leave that cleanup for
some other time.
1. https://lore.kernel.org/git/patch-v6-09.22-5b9278e7bb4-20210907T104559Z-avarab@gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'streaming.c')
-rw-r--r-- | streaming.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/streaming.c b/streaming.c index 5f480ad50c..8beac62cbb 100644 --- a/streaming.c +++ b/streaming.c @@ -223,6 +223,9 @@ static int open_istream_loose(struct git_istream *st, struct repository *r, const struct object_id *oid, enum object_type *type) { + struct object_info oi = OBJECT_INFO_INIT; + oi.sizep = &st->size; + st->u.loose.mapped = map_loose_object(r, oid, &st->u.loose.mapsize); if (!st->u.loose.mapped) return -1; @@ -231,7 +234,7 @@ static int open_istream_loose(struct git_istream *st, struct repository *r, st->u.loose.mapsize, st->u.loose.hdr, sizeof(st->u.loose.hdr)) < 0) || - (parse_loose_header(st->u.loose.hdr, &st->size) < 0)) { + (parse_loose_header(st->u.loose.hdr, &oi, 0) < 0)) { git_inflate_end(&st->z); munmap(st->u.loose.mapped, st->u.loose.mapsize); return -1; |