Skip to content

Commit

Permalink
git log: support "auto" decorations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
torvalds authored and gitster committed May 30, 2014
1 parent e156455 commit 1571586
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin/log.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1571586

Please sign in to comment.