builtin/log: honor log.decorate
[gitweb.git] / builtin / log.c
index 281af8c1ecb04c7be05d9a17a1d5f3bd43420c85..cf2b736ca761194108740f435534b2bc8eb601a5 100644 (file)
@@ -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;
 }
 
@@ -105,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)