提交 0176e7a7 编写于 作者: R René Scharfe 提交者: Junio C Hamano

graph: simplify graph_padding_line()

Deduplicate code common to both branches of if statements.
Signed-off-by: NRene Scharfe <l.s.r@web.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 97b8860c
......@@ -1161,21 +1161,12 @@ static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
*/
for (i = 0; i < graph->num_columns; i++) {
struct column *col = &graph->columns[i];
struct commit *col_commit = col->commit;
if (col_commit == graph->commit) {
strbuf_write_column(sb, col, '|');
if (graph->num_parents < 3)
strbuf_addch(sb, ' ');
else {
int num_spaces = ((graph->num_parents - 2) * 2);
strbuf_addchars(sb, ' ', num_spaces);
}
} else {
strbuf_write_column(sb, col, '|');
if (col->commit == graph->commit && graph->num_parents > 2)
strbuf_addchars(sb, ' ', (graph->num_parents - 2) * 2);
else
strbuf_addch(sb, ' ');
}
}
graph_pad_horizontally(graph, sb, graph->num_columns);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册