test-path-utils: handle const parameter of basename and dirname
[gitweb.git] / builtin / log.c
index 670229cbb4c2a80e7389bc9d65f92455d1d34427..b3b10cc1edba2f6d77fdf4b12c328a7968fb5499 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;
 }
 
@@ -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);