aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-05-29 15:19:40 -0700
committerJunio C Hamano <gitster@pobox.com>2014-05-30 13:47:24 -0700
commit1571586648da4e2d759bce1146d5585c91aca8d6 (patch)
tree6ecee6879f16a55e7a38adb9eea08461608e0594 /builtin
parente156455ea49124c140a67623f22a393db62d5d98 (diff)
downloadgit-1571586648da4e2d759bce1146d5585c91aca8d6.tar.gz
git-1571586648da4e2d759bce1146d5585c91aca8d6.tar.xz
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/log.c2
1 files changed, 2 insertions, 0 deletions
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;
}