git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Adam Simpkins <adam@adamsimpkins.net>
To: git@vger.kernel.org
Cc: Teemu Likonen <tlikonen@iki.fi>, Adam Simpkins <adam@adamsimpkins.net>
Subject: [PATCH] graph API: improve output for merge commits (option 2)
Date: Thu, 29 May 2008 02:04:16 -0700	[thread overview]
Message-ID: <1212051856-32138-1-git-send-email-adam@adamsimpkins.net> (raw)
In-Reply-To: <20080529085752.GA31865@adamsimpkins.net>

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 |
| |\ \

The output for octopus merges was also updated to be more
similar to that for 2-way merges.

Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
---
 graph.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/graph.c b/graph.c
index 26b8c52..92f5b1a 100644
--- a/graph.c
+++ b/graph.c
@@ -535,7 +535,7 @@ static void graph_output_pre_commit_line(struct git_graph *graph,
 		if (col->commit == graph->commit) {
 			seen_this = 1;
 			strbuf_addf(sb, "| %*s", graph->expansion_row, "");
-		} else if (seen_this) {
+		} else if (seen_this && (graph->expansion_row > 0)) {
 			strbuf_addstr(sb, "\\ ");
 		} else {
 			strbuf_addstr(sb, "| ");
@@ -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;
@@ -636,7 +634,7 @@ void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
 					strbuf_addch(sb, '-');
 				strbuf_addstr(sb, ". ");
 			}
-		} else if (seen_this && (graph->num_parents > 1)) {
+		} else if (seen_this && (graph->num_parents > 2)) {
 			strbuf_addstr(sb, "\\ ");
 		} else {
 			strbuf_addstr(sb, "| ");
@@ -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

  parent reply	other threads:[~2008-05-29  9:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 11:24 log --graph: extra space with --pretty=oneline Teemu Likonen
2008-05-28 11:34 ` Wincent Colaiuta
2008-05-29  8:57 ` Adam Simpkins
2008-05-29  9:03   ` [PATCH] graph API: improve output for merge commits (option 1) Adam Simpkins
2008-05-29  9:04   ` Adam Simpkins [this message]
2008-05-29 10:25   ` log --graph: extra space with --pretty=oneline Teemu Likonen
2008-06-01 20:56   ` [PATCH 0/2] graph API: improve printing of merges Adam Simpkins
2008-06-01 20:56     ` [PATCH 1/2] graph API: improve display of merge commits Adam Simpkins
2008-06-01 20:56       ` [PATCH 2/2] graph API: avoid printing unnecessary padding before some octopus merges Adam Simpkins
2008-06-01 21:50         ` Junio C Hamano
2008-06-02  0:04           ` Adam Simpkins
2008-06-02  4:41             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1212051856-32138-1-git-send-email-adam@adamsimpkins.net \
    --to=adam@adamsimpkins.net \
    --cc=git@vger.kernel.org \
    --cc=tlikonen@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).