[PATCH] graph API: improve output for merge commits (option 1)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This eliminates the extra space that sometimes appeared in branch lines
to the right of 2-way merge commits.  (It appeared when the branch line was
displayed as '\' on the line just before the merge commit.)

For example,

| |\
| M  \
| |\  |

is now displayed as

| |\
| M \
| |\ \

Signed-off-by: Adam Simpkins <adam@xxxxxxxxxxxxxxxx>
---
 graph.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/graph.c b/graph.c
index 26b8c52..c3babcb 100644
--- a/graph.c
+++ b/graph.c
@@ -625,10 +625,8 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
 			seen_this = 1;
 			graph_output_commit_char(graph, sb);
 
-			if (graph->num_parents < 2)
+			if (graph->num_parents < 3)
 				strbuf_addch(sb, ' ');
-			else if (graph->num_parents == 2)
-				strbuf_addstr(sb, "  ");
 			else {
 				int num_dashes =
 					((graph->num_parents - 2) * 2) - 1;
@@ -679,9 +677,7 @@ void graph_output_post_merge_line(struct git_graph *graph, struct strbuf *sb)
 			strbuf_addch(sb, '|');
 			for (j = 0; j < graph->num_parents - 1; j++)
 				strbuf_addstr(sb, "\\ ");
-			if (graph->num_parents == 2)
-				strbuf_addch(sb, ' ');
-		} else if (seen_this && (graph->num_parents > 2)) {
+		} else if (seen_this) {
 			strbuf_addstr(sb, "\\ ");
 		} else {
 			strbuf_addstr(sb, "| ");
-- 
1.5.6.rc0.46.gd2b3.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux