[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    [PATCH] log: allow --graph and --show-linear-break used together
From:       Jan_Kundrát <jkt () kde ! org>
Date:       2016-04-08 11:21:07
Message-ID: 3305f7dc-0044-41fe-8aab-ee800535d6e9 () kde ! org
[Download RAW message or body]

This is a multipart/mixed message in MIME format.


Hi,
this patch makes it possible to use --show-linear-break in `git log --graph 
--oneline --all`.

(Please Cc me on replies, I'm not subscribed to the Git ML.)

Cheers,
Jan

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/
["0001-log-allow-graph-and-show-linear-break-used-together.patch" (text/x-patch)]

From 1ac6bb7c31652835d3d046c82e423f0cea6e0904 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan Kundrát?= <jkt@kde.org>
Date: Fri, 8 Apr 2016 13:06:31 +0200
Subject: [PATCH] log: allow --graph and --show-linear-break used together
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

There was no visual break when --graph --oneline was used with several
history trees with disjoint parents.

The original reasoning given in commit 1b32decef was probably that a
graph already conveys enough information to indicate that there's no
parent-child relation between these two commits. However, this is not
the case when a single-line prettification of a log is used, in which
case the commits are displayed on top of each other with no space for
that graph line to show the separation.

It might be interesting to change the actual printing of the break_bar
to print fewer line breaks, but this simple approach works and is IMHO
not that bad visually, anyway.

Signed-off-by: Jan Kundrát <jkt@kde.org>
---
 Documentation/rev-list-options.txt | 5 +++--
 revision.c                         | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 4f009d4..c5e487c 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -807,8 +807,9 @@ This implies the `--topo-order` option by default, but the
 `--date-order` option may also be specified.

 --show-linear-break[=<barrier>]::
-	When --graph is not used, all history branches are flattened
-	which can make it hard to see that the two consecutive commits
+	If the history is flattened, such as when --graph is not used
+	or if --graph is combined with --oneline to produce a compact
+	view, it can be hard to see that the two consecutive commits
 	do not belong to a linear branch. This option puts a barrier
 	in between them in that case. If `<barrier>` is specified, it
 	is the string that will be shown instead of the default one.
diff --git a/revision.c b/revision.c
index 8b2dfe3..809c43e 100644
--- a/revision.c
+++ b/revision.c
@@ -1864,6 +1864,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		   starts_with(arg, "--show-linear-break=")) {
 		if (starts_with(arg, "--show-linear-break="))
 			revs->break_bar = xstrdup(arg + 20);
+		else if (revs->graph)
+			revs->break_bar = "  ..........\n";
 		else
 			revs->break_bar = "                    ..........";
 		revs->track_linear = 1;
@@ -1993,8 +1995,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 			unkv[(*unkc)++] = arg;
 		return opts;
 	}
-	if (revs->graph && revs->track_linear)
-		die("--show-linear-break and --graph are incompatible");

 	return 1;
 }
--
2.7.3


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic