X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=unpack-objects.c;h=3b824b04a262b92808ba138b1922badbbb25da89;hb=fb6a9f93d39e4e5fdb83673a927f71a34e9fb7c0;hp=4b5b5cb3e22454fe487002f698272a19a1d8861d;hpb=8fc11b5aa98540f7caab87e22e5aae63512893a2;p=git.git diff --git a/unpack-objects.c b/unpack-objects.c index 4b5b5cb3..3b824b04 100644 --- a/unpack-objects.c +++ b/unpack-objects.c @@ -2,6 +2,10 @@ #include "object.h" #include "delta.h" #include "pack.h" +#include "blob.h" +#include "commit.h" +#include "tag.h" +#include "tree.h" #include @@ -148,10 +152,10 @@ static int unpack_non_delta_entry(enum object_type kind, unsigned long size) const char *type; switch (kind) { - case OBJ_COMMIT: type = "commit"; break; - case OBJ_TREE: type = "tree"; break; - case OBJ_BLOB: type = "blob"; break; - case OBJ_TAG: type = "tag"; break; + case OBJ_COMMIT: type = commit_type; break; + case OBJ_TREE: type = tree_type; break; + case OBJ_BLOB: type = blob_type; break; + case OBJ_TAG: type = tag_type; break; default: die("bad type %d", kind); } if (!dry_run) @@ -246,13 +250,12 @@ static void unpack_all(void) { int i; struct pack_header *hdr = fill(sizeof(struct pack_header)); - unsigned version = ntohl(hdr->hdr_version); unsigned nr_objects = ntohl(hdr->hdr_entries); if (ntohl(hdr->hdr_signature) != PACK_SIGNATURE) die("bad pack file"); - if (version != PACK_VERSION) - die("unable to handle pack file version %d", version); + if (!pack_version_ok(hdr->hdr_version)) + die("unknown pack file version %d", ntohl(hdr->hdr_version)); fprintf(stderr, "Unpacking %d objects\n", nr_objects); use(sizeof(struct pack_header));