From: Linus Torvalds Date: Thu, 29 May 2014 22:19:40 +0000 (-0700) Subject: git log: support "auto" decorations X-Git-Tag: v2.1.0-rc0~109^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1571586648da4e2d759bce1146d5585c91aca8d6;p=git-core%2Fgit.git git log: support "auto" decorations This works kind of like "--color=auto" - add decorations for interactive use, but do not change defaults when scripting or when piping the output to anything but a terminal. You can use either [log] decorate=auto in the git config files, or the "--decorate=auto" command line option to choose this behavior. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- diff --git a/builtin/log.c b/builtin/log.c index 39e883635..df6396c9c 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -63,6 +63,8 @@ static int parse_decoration_style(const char *var, const char *value) return DECORATE_FULL_REFS; 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 -1; }