From: Hervé Cauwelier Date: Sat, 03 Oct 2009 18:10:01 GMT Subject: [PATCH 6/6] Read an object from a pack file Message-ID: <1254593401-18801-7-git-send-email-herve@itaapy.com> In-Reply-To: <1254593401-18801-6-git-send-email-herve@itaapy.com> Signed-off-by: Hervé Cauwelier --- src/odb.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/odb.c b/src/odb.c index dd3c142..a712d71 100644 --- a/src/odb.c +++ b/src/odb.c @@ -1263,13 +1263,16 @@ static int read_packed(git_obj *out, git_pack *p, const git_oid *id) if (pack_openidx(p)) return GIT_ERROR; + if (pack_openpack(p)) { + pack_decidx(p); + return GIT_ERROR; + } res = p->idx_search(&pos, p, id); pack_decidx(p); + assert(pos < p->pack_map.len); - if (!res) { - /* TODO unpack object at pos */ - res = GIT_ERROR; - } + if (res == GIT_SUCCESS) + return inflate_pack_obj(out, p, pos); return res; } -- 1.6.4.4