| 775 | } |
| 776 | |
| 777 | static int count_objects(const char *path UNUSED, struct oid_array *oids, |
| 778 | enum object_type type, void *cb_data) |
| 779 | { |
| 780 | struct count_objects_data *data = cb_data; |
| 781 | struct object_stats *stats = data->stats; |
| 782 | size_t object_count; |
| 783 | |
| 784 | for (size_t i = 0; i < oids->nr; i++) { |
| 785 | struct object_info oi = OBJECT_INFO_INIT; |
| 786 | unsigned long inflated; |
| 787 | size_t inflated_st = 0; |
| 788 | struct commit *commit; |
| 789 | struct object *obj; |
| 790 | void *content; |
| 791 | off_t disk; |
| 792 | int eaten; |
| 793 | |
| 794 | oi.sizep = &inflated_st; |
| 795 | oi.disk_sizep = &disk; |
| 796 | oi.contentp = &content; |
| 797 | |
| 798 | if (odb_read_object_info_extended(data->odb, &oids->oid[i], &oi, |
| 799 | OBJECT_INFO_SKIP_FETCH_OBJECT | |
| 800 | OBJECT_INFO_QUICK) < 0) |
| 801 | continue; |
| 802 | inflated = cast_size_t_to_ulong(inflated_st); |
| 803 | |
| 804 | obj = parse_object_buffer(the_repository, &oids->oid[i], type, |
| 805 | inflated, content, &eaten); |
| 806 | |
| 807 | switch (type) { |
| 808 | case OBJ_TAG: |
| 809 | stats->type_counts.tags++; |
| 810 | stats->inflated_sizes.tags += inflated; |
| 811 | stats->disk_sizes.tags += disk; |
| 812 | check_largest(&stats->largest.tag_size, &oids->oid[i], |
| 813 | inflated); |
| 814 | break; |
| 815 | case OBJ_COMMIT: |
| 816 | commit = object_as_type(obj, OBJ_COMMIT, 0); |
| 817 | stats->type_counts.commits++; |
| 818 | stats->inflated_sizes.commits += inflated; |
| 819 | stats->disk_sizes.commits += disk; |
| 820 | check_largest(&stats->largest.commit_size, &oids->oid[i], |
| 821 | inflated); |
| 822 | check_largest(&stats->largest.parent_count, &oids->oid[i], |
| 823 | commit_list_count(commit->parents)); |
| 824 | break; |
| 825 | case OBJ_TREE: |
| 826 | stats->type_counts.trees++; |
| 827 | stats->inflated_sizes.trees += inflated; |
| 828 | stats->disk_sizes.trees += disk; |
| 829 | check_largest(&stats->largest.tree_size, &oids->oid[i], |
| 830 | inflated); |
| 831 | check_largest(&stats->largest.tree_entries, &oids->oid[i], |
| 832 | count_tree_entries(obj)); |
| 833 | break; |
| 834 | case OBJ_BLOB: |
nothing calls this directly
no test coverage detected