Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: log --pretty/--oneline: ignore log.decorate

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:35
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Jeff King [off-list ref] writes:
quoted
quoted
* sd/log-decorate (2010-02-17) 3 commits
  (merged to 'next' on 2010-03-08 at 58a6fba)
 + log.decorate: usability fixes
 + Add `log.decorate' configuration variable.
 + git_config_maybe_bool()

Needs squelching the configuration setting when "--pretty=raw" is given,
at least, or possibly when any "--pretty" is explicitly given.
This is necessary if we want to let users specify log.decorate and still
use gitk.  A patch should look like this (of course untested).
Hmm. You took the "any --pretty" option with this patch.
Yeah, I considered to further narrow it down to the --pretty=raw case;
because that is not something we do for the default --show-notes, I opted
for consistency.  But a decoration and notes are quite different, and
such a consistency perhaps is not worth it.  How about this on top?

-- >8 --
Subject: log: only "--pretty=raw" defeats log.decorate from the command line

Unlike notes that are often multi-line and disrupting to be placed in many
output formats, a decoration is designed to be a small token that can be
tacked after an existing line of the output where a commit object name sits.

Disabling log.decorate for something like "log --oneline" would defeat the
purpose of the configuration.

We _might_ want to change it further in the future to force scripts that
do not want to be broken by random end user configurations to explicitly
say "log --no-decorate", but that would be an incompatible change that
needs the usual multi-release-cycle deprecation process.

Signed-off-by: Junio C Hamano <redacted>
---
 builtin-log.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 7f4186f..017fcf8 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -108,10 +108,11 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
 	}
 
 	/*
-	 * defeat log.decorate configuration interacting with --pretty
+	 * defeat log.decorate configuration interacting with --pretty=raw
 	 * from the command line.
 	 */
-	if (!decoration_given && rev->pretty_given)
+	if (!decoration_given && rev->pretty_given
+	    && rev->commit_format == CMIT_FMT_RAW)
 		decoration_style = 0;
 
 	if (decoration_style) {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help