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) {