git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 8, 2010, 17:14 UTC
Message-ID
<7vljcx6f4f.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100408073014.GA15474@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
>> > * 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 <gitster@pobox.com>
---
 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) {
Previous: Jeff KingNext: Jeff King
Message 6 of 8 in “What's cooking in git.git (Apr 2010, #02; Sun, 04)”
  1. Junio C HamanoApr 4, 2010
  2. Michael J GruberApr 6, 2010
  3. Jeff KingApr 6, 2010
  4. log --pretty/--oneline: ignore log.decorateJunio C Hamano, Apr 6, 2010
  5. Jeff KingApr 8, 2010
  6. Junio C HamanoApr 8, 2010
  7. Jeff KingApr 8, 2010
  8. Junio C HamanoApr 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.