| 877 | } |
| 878 | |
| 879 | static void fill_commit_graph_info(struct commit *item, struct commit_graph *g, uint32_t pos) |
| 880 | { |
| 881 | const unsigned char *commit_data; |
| 882 | struct commit_graph_data *graph_data; |
| 883 | uint32_t lex_index, offset_pos; |
| 884 | uint64_t date_high, date_low, offset; |
| 885 | |
| 886 | while (pos < g->num_commits_in_base) |
| 887 | g = g->base_graph; |
| 888 | |
| 889 | if (pos >= g->num_commits + g->num_commits_in_base) |
| 890 | die(_("invalid commit position. commit-graph is likely corrupt")); |
| 891 | |
| 892 | lex_index = pos - g->num_commits_in_base; |
| 893 | commit_data = g->chunk_commit_data + st_mult(graph_data_width(g->hash_algo), lex_index); |
| 894 | |
| 895 | graph_data = commit_graph_data_at(item); |
| 896 | graph_data->graph_pos = pos; |
| 897 | |
| 898 | date_high = get_be32(commit_data + g->hash_algo->rawsz + 8) & 0x3; |
| 899 | date_low = get_be32(commit_data + g->hash_algo->rawsz + 12); |
| 900 | item->date = (timestamp_t)((date_high << 32) | date_low); |
| 901 | |
| 902 | if (g->read_generation_data) { |
| 903 | offset = (timestamp_t)get_be32(g->chunk_generation_data + st_mult(sizeof(uint32_t), lex_index)); |
| 904 | |
| 905 | if (offset & CORRECTED_COMMIT_DATE_OFFSET_OVERFLOW) { |
| 906 | if (!g->chunk_generation_data_overflow) |
| 907 | die(_("commit-graph requires overflow generation data but has none")); |
| 908 | |
| 909 | offset_pos = offset ^ CORRECTED_COMMIT_DATE_OFFSET_OVERFLOW; |
| 910 | if (g->chunk_generation_data_overflow_size / sizeof(uint64_t) <= offset_pos) |
| 911 | die(_("commit-graph overflow generation data is too small")); |
| 912 | graph_data->generation = item->date + |
| 913 | get_be64(g->chunk_generation_data_overflow + sizeof(uint64_t) * offset_pos); |
| 914 | } else |
| 915 | graph_data->generation = item->date + offset; |
| 916 | } else |
| 917 | graph_data->generation = get_be32(commit_data + g->hash_algo->rawsz + 8) >> 2; |
| 918 | |
| 919 | if (g->topo_levels) |
| 920 | *topo_level_slab_at(g->topo_levels, item) = get_be32(commit_data + g->hash_algo->rawsz + 8) >> 2; |
| 921 | } |
| 922 | |
| 923 | static inline void set_commit_tree(struct commit *c, struct tree *t) |
| 924 | { |
no test coverage detected