| 680 | } |
| 681 | |
| 682 | static int writer_dump_object_index(struct reftable_writer *w) |
| 683 | { |
| 684 | struct write_record_arg closure = { .w = w }; |
| 685 | struct common_prefix_arg common = { |
| 686 | .max = 1, /* obj_id_len should be >= 2. */ |
| 687 | }; |
| 688 | int err; |
| 689 | |
| 690 | if (w->obj_index_tree) |
| 691 | infix_walk(w->obj_index_tree, &update_common, &common); |
| 692 | w->stats.object_id_len = common.max + 1; |
| 693 | |
| 694 | err = writer_reinit_block_writer(w, REFTABLE_BLOCK_TYPE_OBJ); |
| 695 | if (err < 0) |
| 696 | return err; |
| 697 | |
| 698 | if (w->obj_index_tree) |
| 699 | infix_walk(w->obj_index_tree, &write_object_record, &closure); |
| 700 | |
| 701 | if (closure.err < 0) |
| 702 | return closure.err; |
| 703 | return writer_finish_section(w); |
| 704 | } |
| 705 | |
| 706 | static int writer_finish_public_section(struct reftable_writer *w) |
| 707 | { |
no test coverage detected