X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=unpack-objects.c;h=b23fe58ce158acdeb077be94fd58ed80a3c2b698;hb=8e27364128b091e76059229d4f009bc7f869fa9f;hp=4b5b5cb3e22454fe487002f698272a19a1d8861d;hpb=476e801111698ac5df6821f389c81abc017fc0c9;p=git.git diff --git a/unpack-objects.c b/unpack-objects.c index 4b5b5cb3e..b23fe58ce 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) @@ -237,22 +241,16 @@ static void unpack_one(unsigned nr, unsigned total) } } -/* - * We unpack from the end, older files first. Now, usually - * there are deltas etc, so we'll not actually write the - * objects in that order, but we might as well try.. - */ 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)); @@ -268,6 +266,7 @@ int main(int argc, char **argv) unsigned char sha1[20]; setup_git_directory(); + git_config(git_default_config); quiet = !isatty(2);