[PATCH] pretty format now configurable
From: Denis Cheng <hidden>
Date: 2016-06-15 22:44:18
Subsystem:
the rest · Maintainer:
Linus Torvalds
* New configuration variable "format.pretty" can be used
in git log/show/whathappened.
Signed-off-by: Denis Cheng <redacted>
---
builtin-log.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index bbadbc0..0f7ee1f 100644
--- a/builtin-log.c
+++ b/builtin-log.c@@ -20,6 +20,7 @@ static int default_show_root = 1; static const char *fmt_patch_subject_prefix = "PATCH"; +static const char *fmt_pretty; static void add_name_decoration(const char *prefix, const char *name, struct object *obj) {
@@ -53,7 +54,8 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, int decorate = 0; rev->abbrev = DEFAULT_ABBREV; - rev->commit_format = CMIT_FMT_DEFAULT; + if (fmt_pretty) + rev->commit_format = get_commit_format(fmt_pretty); rev->verbose_header = 1; DIFF_OPT_SET(&rev->diffopt, RECURSIVE); rev->show_root_diff = default_show_root;
@@ -221,6 +223,12 @@ static int cmd_log_walk(struct rev_info *rev) static int git_log_config(const char *var, const char *value) { + if (!strcmp(var, "format.pretty")) { + if (!value) + config_error_nonbool(var); + fmt_pretty = xstrdup(value); + return 0; + } if (!strcmp(var, "format.subjectprefix")) { if (!value) config_error_nonbool(var);
--
1.5.4.2