MCPcopy Create free account
hub / github.com/git/git / graph_output_commit_line

Function graph_output_commit_line

graph.c:1042–1156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1040}
1041
1042static void graph_output_commit_line(struct git_graph *graph, struct graph_line *line)
1043{
1044 int seen_this = 0;
1045 int i;
1046
1047 /*
1048 * Output the row containing this commit
1049 * Iterate up to and including graph->num_columns,
1050 * since the current commit may not be in any of the existing
1051 * columns. (This happens when the current commit doesn't have any
1052 * children that we have already processed.)
1053 */
1054 seen_this = 0;
1055 for (i = 0; i <= graph->num_columns; i++) {
1056 struct column *col = &graph->columns[i];
1057 struct commit *col_commit;
1058 if (i == graph->num_columns) {
1059 if (seen_this)
1060 break;
1061 col_commit = graph->commit;
1062 } else {
1063 col_commit = graph->columns[i].commit;
1064 }
1065
1066 if (col_commit == graph->commit) {
1067 seen_this = 1;
1068 graph_output_commit_char(graph, line);
1069
1070 if (graph_needs_truncation(graph, i)) {
1071 graph_line_addch(line, ' ');
1072 break;
1073 }
1074
1075 if (graph->num_parents > 2)
1076 graph_draw_octopus_merge(graph, line);
1077 } else if (graph_needs_truncation(graph, i)) {
1078 graph_line_addstr(line, "~ ");
1079 seen_this = 1;
1080 break;
1081 } else if (seen_this && (graph->edges_added > 1)) {
1082 graph_line_write_column(line, col, '\\');
1083 } else if (seen_this && (graph->edges_added == 1)) {
1084 /*
1085 * This is either a right-skewed 2-way merge
1086 * commit, or a left-skewed 3-way merge.
1087 * There is no GRAPH_PRE_COMMIT stage for such
1088 * merges, so this is the first line of output
1089 * for this commit. Check to see what the previous
1090 * line of output was.
1091 *
1092 * If it was GRAPH_POST_MERGE, the branch line
1093 * coming into this commit may have been '\',
1094 * and not '|' or '/'. If so, output the branch
1095 * line as '\' on this line, instead of '|'. This
1096 * makes the output look nicer.
1097 */
1098 if (graph->prev_state == GRAPH_POST_MERGE &&
1099 graph->prev_edges_added > 0 &&

Callers 1

graph_next_lineFunction · 0.85

Calls 10

graph_output_commit_charFunction · 0.85
graph_needs_truncationFunction · 0.85
graph_line_addchFunction · 0.85
graph_draw_octopus_mergeFunction · 0.85
graph_line_addstrFunction · 0.85
graph_line_write_columnFunction · 0.85
graph_update_stateFunction · 0.85
first_interesting_parentFunction · 0.85
graph_is_mapping_correctFunction · 0.85

Tested by

no test coverage detected