Thread (1 message) 1 message, 1 author, 2019-11-20

Re: [PATCH v5 09/11] pretty: add struct cmt_fmt_map::default_date_mode_type

From: Junio C Hamano <hidden>
Date: 2019-11-20 03:16:07

Denton Liu [off-list ref] writes:
In a future commit, we plan on having a pretty format which will use a
default date format unless otherwise overidden. Add support for this by
adding a `default_date_mode_type` member in `struct cmt_fmt_map`.

Signed-off-by: Denton Liu <redacted>
---
 pretty.c | 3 +++
 1 file changed, 3 insertions(+)
Yup, that is what I meant.  expand_tabs_in_log and friends are
good examples of per-format tweak defined in this table, and the
default date mode is a good addition.

Thanks.
quoted hunk
diff --git a/pretty.c b/pretty.c
index 61014cc25a..63fa600276 100644
--- a/pretty.c
+++ b/pretty.c
@@ -20,6 +20,7 @@ static struct cmt_fmt_map {
 	int is_tformat;
 	int expand_tabs_in_log;
 	int is_alias;
+	enum date_mode_type default_date_mode_type;
 	const char *user_format;
 } *commit_formats;
 static size_t builtin_formats_len;
@@ -181,6 +182,8 @@ void get_commit_format(const char *arg, struct rev_info *rev)
 	rev->commit_format = commit_format->format;
 	rev->use_terminator = commit_format->is_tformat;
 	rev->expand_tabs_in_log_default = commit_format->expand_tabs_in_log;
+	if (!rev->date_mode_explicit && commit_format->default_date_mode_type)
+		rev->date_mode.type = commit_format->default_date_mode_type;
 	if (commit_format->format == CMIT_FMT_USERFORMAT) {
 		save_user_format(rev, commit_format->user_format,
 				 commit_format->is_tformat);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help