From: Junio C Hamano Date: Tue, 11 Apr 2017 07:21:51 +0000 (-0700) Subject: Merge branch 'ah/log-decorate-default-to-auto' X-Git-Tag: v2.13.0-rc0~32 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d9758cf81cd8af42a7ab55dc3c1a889d9ddd3f81?hp=-c Merge branch 'ah/log-decorate-default-to-auto' The default behaviour of "git log" in an interactive session has been changed to enable "--decorate". * ah/log-decorate-default-to-auto: log: if --decorate is not given, default to --decorate=auto --- d9758cf81cd8af42a7ab55dc3c1a889d9ddd3f81 diff --combined builtin/log.c index 670229cbb4,d755a59600..b3b10cc1ed --- a/builtin/log.c +++ b/builtin/log.c @@@ -52,6 -52,11 +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 +72,7 @@@ 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 +410,8 @@@ static int git_log_config(const char *v 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); @@@ -1084,7 -1091,8 +1091,7 @@@ static const char *set_outdir(const cha if (!output_directory) return prefix; - return xstrdup(prefix_filename(prefix, outdir_offset, - output_directory)); + return prefix_filename(prefix, output_directory); } static const char * const builtin_format_patch_usage[] = {