| 579 | } |
| 580 | |
| 581 | static void unpack_all(void) |
| 582 | { |
| 583 | int i; |
| 584 | unsigned char *hdr = fill(sizeof(struct pack_header)); |
| 585 | struct odb_transaction *transaction; |
| 586 | |
| 587 | if (get_be32(hdr) != PACK_SIGNATURE) |
| 588 | die("bad pack file"); |
| 589 | hdr += 4; |
| 590 | if (!pack_version_ok_native(get_be32(hdr))) |
| 591 | die("unknown pack file version %"PRIu32, |
| 592 | get_be32(hdr)); |
| 593 | hdr += 4; |
| 594 | nr_objects = get_be32(hdr); |
| 595 | use(sizeof(struct pack_header)); |
| 596 | |
| 597 | if (!quiet) |
| 598 | progress = start_progress(the_repository, |
| 599 | _("Unpacking objects"), nr_objects); |
| 600 | CALLOC_ARRAY(obj_list, nr_objects); |
| 601 | transaction = odb_transaction_begin(the_repository->objects); |
| 602 | for (i = 0; i < nr_objects; i++) { |
| 603 | unpack_one(i); |
| 604 | display_progress(progress, i + 1); |
| 605 | } |
| 606 | odb_transaction_commit(transaction); |
| 607 | stop_progress(&progress); |
| 608 | |
| 609 | if (delta_list) |
| 610 | die("unresolved deltas left after unpacking"); |
| 611 | } |
| 612 | |
| 613 | int cmd_unpack_objects(int argc, |
| 614 | const char **argv, |
no test coverage detected