git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Jan Kundrát" <jkt@kde.org>
To: <git@vger.kernel.org>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] log: allow --graph and --show-linear-break used together
Date: Fri, 08 Apr 2016 13:21:07 +0200	[thread overview]
Message-ID: <3305f7dc-0044-41fe-8aab-ee800535d6e9@kde.org> (raw)

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


             reply	other threads:[~2016-04-08 11:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 11:21 Jan Kundrát [this message]
2016-04-08 12:43 ` [PATCH] log: allow --graph and --show-linear-break used together Duy Nguyen
2016-04-08 17:11 ` 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=3305f7dc-0044-41fe-8aab-ee800535d6e9@kde.org \
    --to=jkt@kde.org \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /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).