summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorAlex Henrie <alexhenrie24@gmail.com>2017-03-24 05:46:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-24 17:38:43 (GMT)
commit940a911f8ec00e291a66c2d1ed05293a38ae6138 (patch)
treecf74ecf92d0ba353999220c2dbb07fc65ccfdde4 /builtin
parentc0f9c705890ac30871c70219c4b08d740fb40e2e (diff)
downloadgit-940a911f8ec00e291a66c2d1ed05293a38ae6138.zip
git-940a911f8ec00e291a66c2d1ed05293a38ae6138.tar.gz
git-940a911f8ec00e291a66c2d1ed05293a38ae6138.tar.bz2
log: if --decorate is not given, default to --decorate=auto
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/log.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 281af8c..d755a59 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -52,6 +52,11 @@ struct line_opt_callback_data {
struct string_list args;
};
+static int auto_decoration_style(void)
+{
+ return (isatty(1) || pager_in_use()) ? DECORATE_SHORT_REFS : 0;
+}
+
static int parse_decoration_style(const char *var, const char *value)
{
switch (git_config_maybe_bool(var, value)) {
@@ -67,7 +72,7 @@ static int parse_decoration_style(const char *var, const char *value)
else if (!strcmp(value, "short"))
return DECORATE_SHORT_REFS;
else if (!strcmp(value, "auto"))
- return (isatty(1) || pager_in_use()) ? DECORATE_SHORT_REFS : 0;
+ return auto_decoration_style();
return -1;
}
@@ -405,6 +410,8 @@ 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);