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 <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Linus Torvalds committed May 29, 2014 at 15:19 UTC 1571586648da4e2d759bce1146d5585c91aca8d6
1 file changed +2
builtin/log.c
+2
@@ -63,6 +63,8 @@ static int parse_decoration_style(const char *var, const char *value)
63 return DECORATE_FULL_REFS;
64 else if (!strcmp(value, "short"))
65 return DECORATE_SHORT_REFS;
66 + else if (!strcmp(value, "auto"))
67 + return (isatty(1) || pager_in_use()) ? DECORATE_SHORT_REFS : 0;
68 return -1;
69 }
70