git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] log: allow --graph and --show-linear-break used together
@ 2016-04-08 11:21 Jan Kundrát
  2016-04-08 12:43 ` Duy Nguyen
  2016-04-08 17:11 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kundrát @ 2016-04-08 11:21 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

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/

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-log-allow-graph-and-show-linear-break-used-together.patch --]
[-- Type: text/x-patch, Size: 2831 bytes --]

From 1ac6bb7c31652835d3d046c82e423f0cea6e0904 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <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


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

end of thread, other threads:[~2016-04-08 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-08 11:21 [PATCH] log: allow --graph and --show-linear-break used together Jan Kundrát
2016-04-08 12:43 ` Duy Nguyen
2016-04-08 17:11 ` Junio C Hamano

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 NNTP newsgroup(s).