All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] graph: simplify graph_padding_line()
@ 2014-09-20 18:29 René Scharfe
  2014-09-20 21:35 ` René Scharfe
  0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2014-09-20 18:29 UTC (permalink / raw
  To: Git Mailing List; +Cc: Junio C Hamano

Deduplicate code common to both branches of if statements.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 graph.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/graph.c b/graph.c
index dfb99f6..52605e4 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);
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] graph: simplify graph_padding_line()
  2014-09-20 18:29 [PATCH 1/2] graph: simplify graph_padding_line() René Scharfe
@ 2014-09-20 21:35 ` René Scharfe
  0 siblings, 0 replies; 2+ messages in thread
From: René Scharfe @ 2014-09-20 21:35 UTC (permalink / raw
  To: Git Mailing List; +Cc: Junio C Hamano

Am 20.09.2014 um 20:29 schrieb René Scharfe:
> Deduplicate code common to both branches of if statements.

There is no 2/2, this patch is the only one at this time.

René

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-20 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-20 18:29 [PATCH 1/2] graph: simplify graph_padding_line() René Scharfe
2014-09-20 21:35 ` René Scharfe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.