зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
b0e621adfd
Коммит
4f62c2bc57
|
@ -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.
|
* 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;
|
decoration_style = 0;
|
||||||
|
|
||||||
if (decoration_style) {
|
if (decoration_style) {
|
||||||
|
|
|
@ -390,62 +390,50 @@ test_expect_success 'log --graph with merge' '
|
||||||
test_expect_success 'log.decorate configuration' '
|
test_expect_success 'log.decorate configuration' '
|
||||||
git config --unset-all log.decorate || :
|
git config --unset-all log.decorate || :
|
||||||
|
|
||||||
git log >expect.none &&
|
git log --oneline >expect.none &&
|
||||||
git log --decorate >expect.short &&
|
git log --oneline --decorate >expect.short &&
|
||||||
git log --decorate=full >expect.full &&
|
git log --oneline --decorate=full >expect.full &&
|
||||||
git log --oneline >expect.oneline &&
|
|
||||||
|
|
||||||
echo "[log] decorate" >>.git/config &&
|
echo "[log] decorate" >>.git/config &&
|
||||||
git log >actual &&
|
|
||||||
test_cmp expect.short actual &&
|
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
test_cmp expect.oneline actual &&
|
test_cmp expect.short actual &&
|
||||||
|
|
||||||
git config --unset-all log.decorate &&
|
git config --unset-all log.decorate &&
|
||||||
git config log.decorate true &&
|
git config log.decorate true &&
|
||||||
git log >actual &&
|
|
||||||
test_cmp expect.short actual &&
|
|
||||||
git log --decorate=full >actual &&
|
|
||||||
test_cmp expect.full actual &&
|
|
||||||
git log --decorate=no >actual &&
|
|
||||||
test_cmp expect.none actual &&
|
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
test_cmp expect.oneline actual &&
|
test_cmp expect.short actual &&
|
||||||
|
git log --oneline --decorate=full >actual &&
|
||||||
|
test_cmp expect.full actual &&
|
||||||
|
git log --oneline --decorate=no >actual &&
|
||||||
|
test_cmp expect.none actual &&
|
||||||
|
|
||||||
git config --unset-all log.decorate &&
|
git config --unset-all log.decorate &&
|
||||||
git config log.decorate no &&
|
git config log.decorate no &&
|
||||||
git log >actual &&
|
|
||||||
test_cmp expect.none actual &&
|
|
||||||
git log --decorate >actual &&
|
|
||||||
test_cmp expect.short actual &&
|
|
||||||
git log --decorate=full >actual &&
|
|
||||||
test_cmp expect.full actual &&
|
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
test_cmp expect.oneline actual &&
|
test_cmp expect.none actual &&
|
||||||
|
git log --oneline --decorate >actual &&
|
||||||
|
test_cmp expect.short actual &&
|
||||||
|
git log --oneline --decorate=full >actual &&
|
||||||
|
test_cmp expect.full actual &&
|
||||||
|
|
||||||
git config --unset-all log.decorate &&
|
git config --unset-all log.decorate &&
|
||||||
git config log.decorate short &&
|
git config log.decorate short &&
|
||||||
git log >actual &&
|
|
||||||
test_cmp expect.short actual &&
|
|
||||||
git log --no-decorate >actual &&
|
|
||||||
test_cmp expect.none actual &&
|
|
||||||
git log --decorate=full >actual &&
|
|
||||||
test_cmp expect.full actual &&
|
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
test_cmp expect.oneline actual &&
|
test_cmp expect.short actual &&
|
||||||
|
git log --oneline --no-decorate >actual &&
|
||||||
|
test_cmp expect.none actual &&
|
||||||
|
git log --oneline --decorate=full >actual &&
|
||||||
|
test_cmp expect.full actual &&
|
||||||
|
|
||||||
git config --unset-all log.decorate &&
|
git config --unset-all log.decorate &&
|
||||||
git config log.decorate full &&
|
git config log.decorate full &&
|
||||||
git log >actual &&
|
|
||||||
test_cmp expect.full actual &&
|
|
||||||
git log --no-decorate >actual &&
|
|
||||||
test_cmp expect.none actual &&
|
|
||||||
git log --decorate >actual &&
|
|
||||||
test_cmp expect.short actual
|
|
||||||
git log --oneline >actual &&
|
git log --oneline >actual &&
|
||||||
test_cmp expect.oneline actual &&
|
test_cmp expect.full actual &&
|
||||||
|
git log --oneline --no-decorate >actual &&
|
||||||
|
test_cmp expect.none actual &&
|
||||||
|
git log --oneline --decorate >actual &&
|
||||||
|
test_cmp expect.short actual
|
||||||
|
|
||||||
:
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Загрузка…
Ссылка в новой задаче