This can be used to enable the display of ref names of commits that are shown by log commands. Each of the log commands (whatchanged, show, reflog, and log) can be enable separately. e.g: [decorate] log reflog Signed-off-by: Steven Drake <sdrake@xxxxxxxxxx> --- Documentation/config.txt | 12 ++++++++++++ builtin-log.c | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 4c36aa9..dc9d6fd 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -740,6 +740,18 @@ commit.template:: "{tilde}/" is expanded to the value of `$HOME` and "{tilde}user/" to the specified user's home directory. +decorate.whatchanged:: +decorate.log:: +decorate.reflog:: +decorate.show:: + Print out the ref names of any commits that are shown by the different + log command. If 'short' is specified, the ref name prefixes + 'refs/heads/', 'refs/tags/' and 'refs/remotes/' will not be printed. + If 'full' is specified, the full ref name (including prefix) will be + printed. May be set as a bool which will be treated as 'short'. + This is the same as the log commands '--decorate' option. + + diff.autorefreshindex:: When using 'git diff' to compare with work tree files, do not consider stat-only change as changed. diff --git a/builtin-log.c b/builtin-log.c index 8d16832..51b5e10 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -24,6 +24,8 @@ static const char *default_date_mode = NULL; static int default_show_root = 1; +static struct { int whatchanged, show, reflog, log;} decorate = {0,0,0,0}; +static int decoration_style = 0; static const char *fmt_patch_subject_prefix = "PATCH"; static const char *fmt_pretty; @@ -35,7 +37,6 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, struct rev_info *rev) { int i; - int decoration_style = 0; rev->abbrev = DEFAULT_ABBREV; rev->commit_format = CMIT_FMT_DEFAULT; @@ -58,9 +59,6 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, usage(builtin_log_usage); argc = setup_revisions(argc, argv, rev, "HEAD"); - if (!rev->show_notes_given && !rev->pretty_given) - rev->show_notes = 1; - if (rev->diffopt.pickaxe || rev->diffopt.filter) rev->always_show_header = 0; if (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) { @@ -244,8 +242,41 @@ static int cmd_log_walk(struct rev_info *rev) return diff_result_code(&rev->diffopt, 0); } +static int set_decoration_style(const char *var, const char *value) +{ + switch (git_config_maybe_bool(var, value)) { + case 0: + return 0; + case 1: + return DECORATE_SHORT_REFS; + default: + break; + } + if (!strcmp(value, "full")) + return DECORATE_FULL_REFS; + else if (!strcmp(value, "short")) + return DECORATE_SHORT_REFS; + return 0; +} + static int git_log_config(const char *var, const char *value, void *cb) { + if (!strcmp(var, "decorate.log")) { + decorate.log = set_decoration_style(var, value); + return 0; + } + if (!strcmp(var, "decorate.reflog")) { + decorate.reflog = set_decoration_style(var, value); + return 0; + } + if (!strcmp(var, "decorate.show")) { + decorate.show = set_decoration_style(var, value); + return 0; + } + if (!strcmp(var, "decorate.whatchanged")) { + decorate.whatchanged = set_decoration_style(var, value); + return 0; + } if (!strcmp(var, "format.pretty")) return git_config_string(&fmt_pretty, var, value); if (!strcmp(var, "format.subjectprefix")) @@ -264,6 +295,7 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix) struct rev_info rev; git_config(git_log_config, NULL); + decoration_style = decorate.whatchanged; if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; @@ -331,6 +363,7 @@ int cmd_show(int argc, const char **argv, const char *prefix) int i, count, ret = 0; git_config(git_log_config, NULL); + decoration_style = decorate.show; if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; @@ -407,6 +440,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix) struct rev_info rev; git_config(git_log_config, NULL); + decoration_style = decorate.reflog; if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; @@ -440,6 +474,7 @@ int cmd_log(int argc, const char **argv, const char *prefix) struct rev_info rev; git_config(git_log_config, NULL); + decoration_style = decorate.log; if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; -- 1.6.6 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html