| 1744 | } |
| 1745 | |
| 1746 | static void compute_generation_numbers(struct write_commit_graph_context *ctx) |
| 1747 | { |
| 1748 | int i; |
| 1749 | struct compute_generation_info info = { |
| 1750 | .r = ctx->r, |
| 1751 | .commits = &ctx->commits, |
| 1752 | .get_generation = get_generation_from_graph_data, |
| 1753 | .set_generation = set_generation_v2, |
| 1754 | }; |
| 1755 | |
| 1756 | if (ctx->report_progress) |
| 1757 | info.progress = ctx->progress |
| 1758 | = start_delayed_progress( |
| 1759 | ctx->r, |
| 1760 | _("Computing commit graph generation numbers"), |
| 1761 | ctx->commits.nr); |
| 1762 | |
| 1763 | if (!ctx->trust_generation_numbers) { |
| 1764 | for (i = 0; i < ctx->commits.nr; i++) { |
| 1765 | struct commit *c = ctx->commits.items[i]; |
| 1766 | repo_parse_commit(ctx->r, c); |
| 1767 | commit_graph_data_at(c)->generation = GENERATION_NUMBER_ZERO; |
| 1768 | } |
| 1769 | } |
| 1770 | |
| 1771 | compute_reachable_generation_numbers(&info, 2); |
| 1772 | |
| 1773 | for (i = 0; i < ctx->commits.nr; i++) { |
| 1774 | struct commit *c = ctx->commits.items[i]; |
| 1775 | timestamp_t offset = compute_generation_offset(c); |
| 1776 | if (offset > GENERATION_NUMBER_V2_OFFSET_MAX) |
| 1777 | ctx->num_generation_data_overflows++; |
| 1778 | } |
| 1779 | stop_progress(&ctx->progress); |
| 1780 | } |
| 1781 | |
| 1782 | static void set_generation_in_graph_data(struct commit *c, timestamp_t t, |
| 1783 | void *data UNUSED) |
no test coverage detected