summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-09-20 20:29:53 +0200
committerJunio C Hamano <gitster@pobox.com>2014-09-22 12:39:57 -0700
commit0176e7a71f2c722effde0ed22db3682400010911 (patch)
tree66efae7705e1de30828638de3b6e919cd3aba96e /graph.c
parent97b8860c071898d9e162678ea1035a8ced2f8b1f (diff)
downloadgit-0176e7a71f2c722effde0ed22db3682400010911.tar.gz
graph: simplify graph_padding_line()rs/graph-simplify
Deduplicate code common to both branches of if statements. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/graph.c b/graph.c
index dfb99f6436..52605e4f6b 100644
--- a/graph.c
+++ b/graph.c
@@ -1161,20 +1161,11 @@ 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, '|');
+ 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);