Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-11 10:21:51 +0300
committerJunio C Hamano <gitster@pobox.com>2017-04-11 10:21:51 +0300
commitd9758cf81cd8af42a7ab55dc3c1a889d9ddd3f81 (patch)
treeadf2a41ed8873a16e8f14dc9845a0ba840ccf8b0 /builtin/log.c
parentd1d3d46146e1256efe8ad2a2bb0dd877a738c07d (diff)
parent940a911f8ec00e291a66c2d1ed05293a38ae6138 (diff)
Merge branch 'ah/log-decorate-default-to-auto'
The default behaviour of "git log" in an interactive session has been changed to enable "--decorate". * ah/log-decorate-default-to-auto: log: if --decorate is not given, default to --decorate=auto
Diffstat (limited to 'builtin/log.c')
-rw-r--r--builtin/log.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 670229cbb4..b3b10cc1ed 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -52,6 +52,11 @@ struct line_opt_callback_data {
struct string_list args;
};
+static int auto_decoration_style(void)
+{
+ return (isatty(1) || pager_in_use()) ? DECORATE_SHORT_REFS : 0;
+}
+
static int parse_decoration_style(const char *var, const char *value)
{
switch (git_config_maybe_bool(var, value)) {
@@ -67,7 +72,7 @@ static int parse_decoration_style(const char *var, const char *value)
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 auto_decoration_style();
return -1;
}
@@ -405,6 +410,8 @@ static int git_log_config(const char *var, const char *value, void *cb)
if (decoration_style < 0)
decoration_style = 0; /* maybe warn? */
return 0;
+ } else {
+ decoration_style = auto_decoration_style();
}
if (!strcmp(var, "log.showroot")) {
default_show_root = git_config_bool(var, value);