Signed-off-by: Nicolas Pitre <nico@xxxxxxxxxxx> --- Makefile | 1 + packv4-parse.c | 1 + packv4-parse.h | 7 +++++++ sha1_file.c | 10 ++++++++++ 4 files changed, 19 insertions(+) create mode 100644 packv4-parse.h diff --git a/Makefile b/Makefile index ba6cafc..22fc276 100644 --- a/Makefile +++ b/Makefile @@ -702,6 +702,7 @@ LIB_H += notes.h LIB_H += object.h LIB_H += pack-revindex.h LIB_H += pack.h +LIB_H += packv4-parse.h LIB_H += parse-options.h LIB_H += patch-ids.h LIB_H += pathspec.h diff --git a/packv4-parse.c b/packv4-parse.c index bca1a97..431f47e 100644 --- a/packv4-parse.c +++ b/packv4-parse.c @@ -9,6 +9,7 @@ */ #include "cache.h" +#include "packv4-parse.h" #include "varint.h" const unsigned char *get_sha1ref(struct packed_git *p, diff --git a/packv4-parse.h b/packv4-parse.h new file mode 100644 index 0000000..40aa75a --- /dev/null +++ b/packv4-parse.h @@ -0,0 +1,7 @@ +#ifndef PACKV4_PARSE_H +#define PACKV4_PARSE_H + +void *pv4_get_commit(struct packed_git *p, struct pack_window **w_curs, + off_t offset, unsigned long size); + +#endif diff --git a/sha1_file.c b/sha1_file.c index f3bfa28..b57d9f8 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -19,6 +19,7 @@ #include "tree-walk.h" #include "refs.h" #include "pack-revindex.h" +#include "packv4-parse.h" #include "sha1-lookup.h" #include "bulk-checkin.h" #include "streaming.h" @@ -2172,6 +2173,15 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset, break; case OBJ_COMMIT: case OBJ_TREE: + if (p->version >= 4 && !base_from_cache) { + if (type == OBJ_COMMIT) { + data = pv4_get_commit(p, &w_curs, curpos, size); + } else { + die("no pack v4 tree parsing yet"); + } + break; + } + /* fall through */ case OBJ_BLOB: case OBJ_TAG: if (!base_from_cache) -- 1.8.4.38.g317e65b -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html