@matheusbsbs / matheus-bagliano / commits / 4f62c2bc57
Fork 0

log.decorate: only ignore it under "log --pretty=raw"

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>

Junio C Hamano committed Apr 8, 2010 at 10:17 UTC 4f62c2bc577bbb85b65f3261c7fab7ef74def4cd
2 files changed +19 -30
builtin-log.c
+3 -2
@@ -108,10 +108,11 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
108 }
109
110 /*
111 - * defeat log.decorate configuration interacting with --pretty
111 + * defeat log.decorate configuration interacting with --pretty=raw
112 * from the command line.
113 */
114 - if (!decoration_given && rev->pretty_given)
114 + if (!decoration_given && rev->pretty_given
115 + && rev->commit_format == CMIT_FMT_RAW)
116 decoration_style = 0;
117
118 if (decoration_style) {
t/t4202-log.sh
+16 -28
@@ -390,62 +390,50 @@ test_expect_success 'log --graph with merge' '
390 test_expect_success 'log.decorate configuration' '
391 git config --unset-all log.decorate || :
392
393 - git log >expect.none &&
394 - git log --decorate >expect.short &&
395 - git log --decorate=full >expect.full &&
396 - git log --oneline >expect.oneline &&
393 + git log --oneline >expect.none &&
394 + git log --oneline --decorate >expect.short &&
395 + git log --oneline --decorate=full >expect.full &&
396
397 echo "[log] decorate" >>.git/config &&
399 - git log >actual &&
400 - test_cmp expect.short actual &&
398 git log --oneline >actual &&
402 - test_cmp expect.oneline actual &&
399 + test_cmp expect.short actual &&
400
401 git config --unset-all log.decorate &&
402 git config log.decorate true &&
406 - git log >actual &&
403 + git log --oneline >actual &&
404 test_cmp expect.short actual &&
408 - git log --decorate=full >actual &&
405 + git log --oneline --decorate=full >actual &&
406 test_cmp expect.full actual &&
410 - git log --decorate=no >actual &&
407 + git log --oneline --decorate=no >actual &&
408 test_cmp expect.none actual &&
412 - git log --oneline >actual &&
413 - test_cmp expect.oneline actual &&
409
410 git config --unset-all log.decorate &&
411 git config log.decorate no &&
417 - git log >actual &&
412 + git log --oneline >actual &&
413 test_cmp expect.none actual &&
419 - git log --decorate >actual &&
414 + git log --oneline --decorate >actual &&
415 test_cmp expect.short actual &&
421 - git log --decorate=full >actual &&
416 + git log --oneline --decorate=full >actual &&
417 test_cmp expect.full actual &&
423 - git log --oneline >actual &&
424 - test_cmp expect.oneline actual &&
418
419 git config --unset-all log.decorate &&
420 git config log.decorate short &&
428 - git log >actual &&
421 + git log --oneline >actual &&
422 test_cmp expect.short actual &&
430 - git log --no-decorate >actual &&
423 + git log --oneline --no-decorate >actual &&
424 test_cmp expect.none actual &&
432 - git log --decorate=full >actual &&
425 + git log --oneline --decorate=full >actual &&
426 test_cmp expect.full actual &&
434 - git log --oneline >actual &&
435 - test_cmp expect.oneline actual &&
427
428 git config --unset-all log.decorate &&
429 git config log.decorate full &&
439 - git log >actual &&
430 + git log --oneline >actual &&
431 test_cmp expect.full actual &&
441 - git log --no-decorate >actual &&
432 + git log --oneline --no-decorate >actual &&
433 test_cmp expect.none actual &&
443 - git log --decorate >actual &&
434 + git log --oneline --decorate >actual &&
435 test_cmp expect.short actual
445 - git log --oneline >actual &&
446 - test_cmp expect.oneline actual &&
436
448 - :
437 '
438
439 test_done