| 764 | } |
| 765 | |
| 766 | void graph_update(struct git_graph *graph, struct commit *commit) |
| 767 | { |
| 768 | struct commit_list *parent; |
| 769 | |
| 770 | /* |
| 771 | * Set the new commit |
| 772 | */ |
| 773 | graph->commit = commit; |
| 774 | |
| 775 | /* |
| 776 | * Count how many interesting parents this commit has |
| 777 | */ |
| 778 | graph->num_parents = 0; |
| 779 | for (parent = first_interesting_parent(graph); |
| 780 | parent; |
| 781 | parent = next_interesting_parent(graph, parent)) |
| 782 | { |
| 783 | graph->num_parents++; |
| 784 | } |
| 785 | |
| 786 | /* |
| 787 | * Store the old commit_index in prev_commit_index. |
| 788 | * graph_update_columns() will update graph->commit_index for this |
| 789 | * commit. |
| 790 | */ |
| 791 | graph->prev_commit_index = graph->commit_index; |
| 792 | |
| 793 | /* |
| 794 | * Call graph_update_columns() to update |
| 795 | * columns, new_columns, and mapping. |
| 796 | */ |
| 797 | graph_update_columns(graph); |
| 798 | |
| 799 | graph->expansion_row = 0; |
| 800 | |
| 801 | /* |
| 802 | * Update graph->state. |
| 803 | * Note that we don't call graph_update_state() here, since |
| 804 | * we don't want to update graph->prev_state. No line for |
| 805 | * graph->state was ever printed. |
| 806 | * |
| 807 | * If the previous commit didn't get to the GRAPH_PADDING state, |
| 808 | * it never finished its output. Goto GRAPH_SKIP, to print out |
| 809 | * a line to indicate that portion of the graph is missing. |
| 810 | * |
| 811 | * If there are 3 or more parents, we may need to print extra rows |
| 812 | * before the commit, to expand the branch lines around it and make |
| 813 | * room for it. We need to do this only if there is a branch row |
| 814 | * (or more) to the right of this commit. |
| 815 | * |
| 816 | * If there are less than 3 parents, we can immediately print the |
| 817 | * commit line. |
| 818 | */ |
| 819 | if (graph->state != GRAPH_PADDING) |
| 820 | graph->state = GRAPH_SKIP; |
| 821 | else if (graph_needs_pre_commit_line(graph)) |
| 822 | graph->state = GRAPH_PRE_COMMIT; |
| 823 | else |
no test coverage detected