All of lore.kernel.org
 help / color / mirror / Atom feed
From: Allan Caffee <allan.caffee@gmail.com>
To: Teemu Likonen <tlikonen@iki.fi>
Cc: git@vger.kernel.org
Subject: [PATCH] graph API: fix extra space during pre_commit_line state
Date: Tue, 21 Apr 2009 14:34:12 -0400	[thread overview]
Message-ID: <20090421183412.GA8499@linux.vnet> (raw)
In-Reply-To: <87zlea9lit.fsf_-_@iki.fi>

An extra space is being inserted between the "commit" column and all of
the successive edges.  Remove this space.  This regression was
introduced by 427fc5b.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
---
 graph.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

On Tue, 21 Apr 2009, Teemu Likonen wrote:
> The colored log graph implementation (commit 427fc5b) introduces an
> alignment bug which looks like this:
> 
> | | * | edf2e37 git-apply: work from subdirectory.
> | | * | 4ca0660 working from subdirectory: preparation
> | |  | |        
> | |   \ \       
> | |    \ \      
> | |     \ \     
> | |      \ \    
> | |       \ \   
> | *-----. \ \   5401f30 Merge branches 'jc/apply', 'lt/ls-tree', [...]
> | |\ \ \ \ \ \  
> | | | | | * | | 0501c24 Tutorial: adjust merge example to recursive [...]
> 
> 
> In other words, the diagonal lines after this octopus merge are aligned
> wrong. To see it yourself type
> 
>     git log --graph --oneline a957207
> 
> in the Git repository and scroll the output down a bit. Note that the
> bug exists with both --color _and_ --no-color.

It's actually the lines before the merge that are shifted to the right
by one.  This patch should fix that.

This issue exposes a gap in the existing test coverage, which doesn't
exercise the pre_commit_line code.  Maybe another patch is in order to
extend t4202-log to cover pre-commit lines and octopus merges.

diff --git a/graph.c b/graph.c
index d4571cf..31e09eb 100644
--- a/graph.c
+++ b/graph.c
@@ -727,8 +727,8 @@ static void graph_output_pre_commit_line(struct git_graph *graph,
 		if (col->commit == graph->commit) {
 			seen_this = 1;
 			strbuf_write_column(sb, col, '|');
-			strbuf_addf(sb, " %*s", graph->expansion_row, "");
-			chars_written += 2 + graph->expansion_row;
+			strbuf_addf(sb, "%*s", graph->expansion_row, "");
+			chars_written += 1 + graph->expansion_row;
 		} else if (seen_this && (graph->expansion_row == 0)) {
 			/*
 			 * This is the first line of the pre-commit output.
-- 
1.5.6.3

  reply	other threads:[~2009-04-21 18:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21  0:40 [RFC/PATCH] graph API: Use horizontal lines for more compact graphs Allan Caffee
2009-04-21  0:56 ` Johannes Schindelin
2009-04-21  2:23   ` Allan Caffee
2009-04-21  8:13     ` Johannes Schindelin
2009-04-21 12:47       ` [RFC/PATCH v2] " Allan Caffee
2009-04-21 13:17         ` Johannes Schindelin
2009-04-21 13:36         ` Bug in colored "log --graph" implementation Teemu Likonen
2009-04-21 18:34           ` Allan Caffee [this message]
2009-04-22  3:25             ` [PATCH] graph API: fix extra space during pre_commit_line state Teemu Likonen
2009-04-22 19:38               ` Allan Caffee
2009-04-22 19:52                 ` [PATCH 2/3] " Allan Caffee
2009-04-22 21:27                 ` [PATCH 1/3] t4202-log: extend test coverage of graphing Allan Caffee
2009-04-22 21:27                 ` [PATCH 2/3] graph API: fix extra space during pre_commit_line state Allan Caffee
2009-04-22 21:27                 ` [PATCH 3/3] graph API: fix a bug in the rendering of octopus merges Allan Caffee
2009-04-22 21:28         ` [RFC/PATCH v2] graph API: Use horizontal lines for more compact graphs Allan Caffee
2009-04-27 15:43           ` [PATCH v2 (resend)] " Allan Caffee
2009-04-27 16:35             ` 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

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

  git send-email \
    --in-reply-to=20090421183412.GA8499@linux.vnet \
    --to=allan.caffee@gmail.com \
    --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.
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.