{"thread":{"id":"13569","subject":"[PATCH] Add format.date config variable","startedAt":"2008-05-18T17:13:06Z","lastAt":"2008-05-21T23:27:35Z","messageCount":4,"participants":["Heikki Orsila","Teemu Likonen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"77235","messageId":"20080518171306.GA12948@zakalwe.fi","threadId":"13569","inReplyTo":null,"subject":"[PATCH] Add format.date config variable","fromName":"Heikki Orsila","fromEmail":"heikki.orsila@iki.fi","sentAt":"2008-05-18T17:13:06Z","receivedAt":"2008-05-18T17:13:06Z","isPatch":true,"sender":{"key":"heikki.orsila@iki.fi","avatar":null},"body":"format.date config variable sets the default date-time mode for the log\ncommand. Setting format.date value is similar to using git log's --date\noption.\n\nAlso, add missing \"short\" alternative to --date in rev-list-options.txt.\n---\nI wanted to read all the logs in ISO 8601 time format so I decided to \nimplement this option.\n\n Documentation/config.txt           |    6 ++++++\n Documentation/rev-list-options.txt |    5 +++--\n builtin-log.c                      |   10 ++++++++++\n 3 files changed, 19 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 217980f..ddc68bd 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -573,6 +573,12 @@ fetch.unpackLimit::\n \tespecially on slow filesystems.  If not set, the value of\n \t`transfer.unpackLimit` is used instead.\n \n+format.date::\n+\tSet default date-time mode for the log command. Setting format.date\n+\tvalue is similar to using git log's --date option. The value is one of\n+\tfollowing alternatives: {relative,local,default,iso,rfc,short}.\n+\tSee linkgit:git-log[1].\n+\n format.numbered::\n \tA boolean which can enable sequence numbers in patch subjects.\n \tSetting this option to \"auto\" will enable it only if there is\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 2648a55..3d47dc9 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -13,10 +13,11 @@ include::pretty-options.txt[]\n \n \tSynonym for `--date=relative`.\n \n---date={relative,local,default,iso,rfc}::\n+--date={relative,local,default,iso,rfc,short}::\n \n \tOnly takes effect for dates shown in human-readable format, such\n-\tas when using \"--pretty\".\n+\tas when using \"--pretty\". format.date config variable sets a default\n+\tvalue for log command's --date option.\n +\n `--date=relative` shows dates relative to the current time,\n e.g. \"2 hours ago\".\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 9d046b2..d3ff8f6 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -18,6 +18,9 @@\n #include \"run-command.h\"\n #include \"shortlog.h\"\n \n+/* Set a default date-time format for git log */\n+static const char *default_date_mode = NULL;\n+\n static int default_show_root = 1;\n static const char *fmt_patch_subject_prefix = \"PATCH\";\n static const char *fmt_pretty;\n@@ -61,7 +64,12 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \tDIFF_OPT_SET(&rev->diffopt, RECURSIVE);\n \trev->show_root_diff = default_show_root;\n \trev->subject_prefix = fmt_patch_subject_prefix;\n+\n+\tif (default_date_mode)\n+\t\trev->date_mode = parse_date_format(default_date_mode);\n+\n \targc = setup_revisions(argc, argv, rev, \"HEAD\");\n+\n \tif (rev->diffopt.pickaxe || rev->diffopt.filter)\n \t\trev->always_show_header = 0;\n \tif (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {\n@@ -224,6 +232,8 @@ static int cmd_log_walk(struct rev_info *rev)\n \n static int git_log_config(const char *var, const char *value)\n {\n+\tif (!strcmp(var, \"format.date\"))\n+\t\treturn git_config_string(&default_date_mode, var, value);\n \tif (!strcmp(var, \"format.pretty\"))\n \t\treturn git_config_string(&fmt_pretty, var, value);\n \tif (!strcmp(var, \"format.subjectprefix\")) {\n-- \n1.5.4.4\n"},{"id":"77236","messageId":"20080518173914.GA4801@mithlond.arda.local","threadId":"13569","inReplyTo":"20080518171306.GA12948@zakalwe.fi","subject":"Re: [PATCH] Add format.date config variable","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-05-18T17:39:14Z","receivedAt":"2008-05-18T17:39:14Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Heikki Orsila kirjoitti (18.5.2008 klo 20.13):\n\n> I wanted to read all the logs in ISO 8601 time format so I decided to\n> implement this option.\n\nThank you. To my (our) Finnish eyes ISO 8601 is much clearer than the\ndefault.\n"},{"id":"77403","messageId":"7vtzgr347p.fsf@gitster.siamese.dyndns.org","threadId":"13569","inReplyTo":"20080518171306.GA12948@zakalwe.fi","subject":"Re: [PATCH] Add format.date config variable","fromName":"Junio C Hamano","fromEmail":"junio@pobox.com","sentAt":"2008-05-21T18:24:42Z","receivedAt":"2008-05-21T18:24:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Heikki Orsila <heikki.orsila@iki.fi> writes:\n\n> format.date config variable sets the default date-time mode for the log\n> command. Setting format.date value is similar to using git log's --date\n> option.\n>\n> Also, add missing \"short\" alternative to --date in rev-list-options.txt.\n\nGood change but is a separate issue.  Please make it a [PATCH 1/2].\n\n> ---\n\nLacking Sign-off.\n\n> I wanted to read all the logs in ISO 8601 time format so I decided to \n> implement this option.\n\nGood intention.\n\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index 217980f..ddc68bd 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -573,6 +573,12 @@ fetch.unpackLimit::\n>  \tespecially on slow filesystems.  If not set, the value of\n>  \t`transfer.unpackLimit` is used instead.\n>  \n> +format.date::\n> +\tSet default date-time mode for the log command. Setting format.date\n> +\tvalue is similar to using git log's --date option. The value is one of\n> +\tfollowing alternatives: {relative,local,default,iso,rfc,short}.\n> +\tSee linkgit:git-log[1].\n> +\n\nLook at other \"format.*\" variables --- notice that most of them are about\n\"format-patch\" command?  And you absolutely do NOT want this \"default date\nformat for log family\" to apply to \"format-patch\" command.\n\n> diff --git a/builtin-log.c b/builtin-log.c\n> index 9d046b2..d3ff8f6 100644\n> --- a/builtin-log.c\n> +++ b/builtin-log.c\n> @@ -18,6 +18,9 @@\n\nThe patch itself is good, especially that you made sure that format-patch\noutput is not affected.\n\nAs to the configuration variable name, I'd suggest \"log.date\" instead.  We\nmay have to deprecate format.pretty and move it to something else for\nconsistency, though.  Just like we do not want \"format.date\" applied to\nformat-patch, we never want \"format.pretty\" apply to it either.\n"},{"id":"77429","messageId":"20080521232735.GB10527@jolt.modeemi.cs.tut.fi","threadId":"13569","inReplyTo":"7vtzgr347p.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add format.date config variable","fromName":"Heikki Orsila","fromEmail":"shd@modeemi.fi","sentAt":"2008-05-21T23:27:35Z","receivedAt":"2008-05-21T23:27:35Z","isPatch":true,"sender":{"key":"shd@modeemi.fi","avatar":null},"body":"On Wed, May 21, 2008 at 11:24:42AM -0700, Junio C Hamano wrote:\n> > Also, add missing \"short\" alternative to --date in rev-list-options.txt.\n> \n> Good change but is a separate issue.  Please make it a [PATCH 1/2].\n\nWill do that a separate patch.\n\n> Lacking Sign-off.\n\nOK. Thanks.\n\n> The patch itself is good, especially that you made sure that format-patch\n> output is not affected.\n> \n> As to the configuration variable name, I'd suggest \"log.date\" instead.\n\nOK.\n\nWill submit a patch later today.\n\n-- \nHeikki Orsila\nheikki.orsila@iki.fi\nhttp://www.iki.fi/shd\n"}]}