diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2017-05-14 18:00:58 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-15 11:33:19 +0900 |
commit | c74271aae74c951ab321aa16fe573ea3bcab86ba (patch) | |
tree | 42e07488454cc968c5c7e3b26dda67a7732ed26b | |
parent | 940a911f8ec00e291a66c2d1ed05293a38ae6138 (diff) | |
download | git-c74271aae74c951ab321aa16fe573ea3bcab86ba.tar.gz git-c74271aae74c951ab321aa16fe573ea3bcab86ba.tar.xz |
builtin/log: honor log.decorate
The recent change that introduced autodecorating of refs accidentally
broke the ability of users to set log.decorate = false to override it.
When the git_log_config was traversed a second time with an option other
than log.decorate, the decoration style would be set to the automatic
style, even if the user had already overridden it. Instead of setting
the option in config parsing, set it in init_log_defaults instead.
Add a test for this case. The actual additional config option doesn't
matter, but it needs to be something not already set in the
configuration file.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Alex Henrie <alexhenrie24@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/log.c | 4 | ||||
-rwxr-xr-x | t/t4202-log.sh | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/builtin/log.c b/builtin/log.c index d755a5960..cf2b736ca 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -110,6 +110,8 @@ static void init_log_defaults(void) { init_grep_defaults(); init_diff_ui_defaults(); + + decoration_style = auto_decoration_style(); } static void cmd_log_init_defaults(struct rev_info *rev) @@ -410,8 +412,6 @@ static int git_log_config(const char *var, const char *value, void *cb) if (decoration_style < 0) decoration_style = 0; /* maybe warn? */ return 0; - } else { - decoration_style = auto_decoration_style(); } if (!strcmp(var, "log.showroot")) { default_show_root = git_config_bool(var, value); diff --git a/t/t4202-log.sh b/t/t4202-log.sh index f57799071..1c7d6729c 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -577,6 +577,18 @@ test_expect_success 'log.decorate configuration' ' ' +test_expect_success 'log.decorate config parsing' ' + git log --oneline --decorate=full >expect.full && + git log --oneline --decorate=short >expect.short && + + test_config log.decorate full && + test_config log.mailmap true && + git log --oneline >actual && + test_cmp expect.full actual && + git log --oneline --decorate=short >actual && + test_cmp expect.short actual +' + test_expect_success TTY 'log output on a TTY' ' git log --oneline --decorate >expect.short && |