From: Linus Torvalds <torva...@linux-foundation.org>
Date: Thu, 29 May 2014 15:19:40 -0700
Subject: [RFC PATCH] 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
in the git config files, or the "--decorate=auto" command line option to
choose this behavior.
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
I actually like seeing decorations by default, but I do *not* think our
current "log.decorate" options make sense, since they will change any
random use of "git log" to have decorations. I much prefer the
"ui.color=auto" behavior that we have for coloration. This is a trivial
patch that tries to approximate that.
It's marked with RFC because
(a) that "isatty(1) || pager_in_use()" test is kind of hacky, maybe we
would be better off sharing something with the auto-coloration?
(b) I also think it would be nice to have the equivalent for
"--show-signature", but there we don't have any preexisting config
(c) maybe somebody would like a way to combine "auto" and "full",
although personally that doesn't seem to strike me as all that useful
(would you really want to see the full refname when not scripting it)
but the patch is certainly simple and seems to work. Comments?
builtin/log.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builtin/log.c b/builtin/log.c
index 39e883635279..df6396c9c3d9 100644
@@ -63,6 +63,8 @@ static int parse_decoration_style(const char *var, const char
else if (!strcmp(value, "short"))
+ else if (!strcmp(value, "auto"))
+ return (isatty(1) || pager_in_use()) ? DECORATE_SHORT_REFS : 0;
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html