{"thread":{"id":"27144","subject":"[RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","startedAt":"2011-04-20T02:45:03Z","lastAt":"2011-04-25T18:29:58Z","messageCount":37,"participants":["Michael Witten","Jeff King","Jonathan Nieder","Junio C Hamano","Thiago Farina","Alex Riesen","Miles Bader","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"166118","messageId":"650ac72c-fa55-491e-a2e8-427b04d8bee3-mfwitten@gmail.com","threadId":"27144","inReplyTo":"0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com","subject":"[RFC 1/5] Light refactoring of date infrastructure","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T02:45:03Z","receivedAt":"2011-04-20T02:45:03Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"Date: Fri, 11 Feb 2011 18:34:29 +0000\ndate_mode_explicit -> date_mode_from_command_line\n    It's more understandable by itself now.\n\nDATE_NORMAL -> DATE_DEFAULT\n    The user input to select this value is `default'.\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n archive.c              |    2 +-\n builtin/blame.c        |    3 +--\n builtin/commit.c       |    2 +-\n builtin/for-each-ref.c |    2 +-\n builtin/shortlog.c     |    2 +-\n cache.h                |    2 +-\n date.c                 |    2 +-\n log-tree.c             |    6 +++---\n revision.c             |    4 ++--\n revision.h             |    2 +-\n submodule.c            |    2 +-\n 11 files changed, 14 insertions(+), 15 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex 42f2d2f..dd871ca 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -32,7 +32,7 @@ static void format_subst(const struct commit *commit,\n \tchar *to_free = NULL;\n \tstruct strbuf fmt = STRBUF_INIT;\n \tstruct pretty_print_context ctx = {0};\n-\tctx.date_mode = DATE_NORMAL;\n+\tctx.date_mode = DATE_DEFAULT;\n \tctx.abbrev = DEFAULT_ABBREV;\n \n \tif (src == buf->buf)\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 4639788..dd597f4 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -2377,9 +2377,8 @@ parse_done:\n \t\tblame_date_width = sizeof(\"2006-10-19\");\n \t\tbreak;\n \tcase DATE_RELATIVE:\n-\t\t/* \"normal\" is used as the fallback for \"relative\" */\n \tcase DATE_LOCAL:\n-\tcase DATE_NORMAL:\n+\tcase DATE_DEFAULT:\n \t\tblame_date_width = sizeof(\"Thu Oct 19 16:00:04 2006 -0700\");\n \t\tbreak;\n \t}\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 67757e9..194db99 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -933,7 +933,7 @@ static const char *find_author_by_nickname(const char *name)\n \tcommit = get_revision(&revs);\n \tif (commit) {\n \t\tstruct pretty_print_context ctx = {0};\n-\t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.date_mode = DATE_DEFAULT;\n \t\tstrbuf_release(&buf);\n \t\tformat_commit_message(commit, \"%an <%ae>\", &buf, &ctx);\n \t\treturn strbuf_detach(&buf, NULL);\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex 89e75c6..60d6b32 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -367,7 +367,7 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam\n \tchar *zone;\n \tunsigned long timestamp;\n \tlong tz;\n-\tenum date_mode date_mode = DATE_NORMAL;\n+\tenum date_mode date_mode = DATE_DEFAULT;\n \tconst char *formatp;\n \n \t/*\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex f5efc67..5815f55 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -165,7 +165,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.abbrev = log->abbrev;\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n-\t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.date_mode = DATE_DEFAULT;\n \t\tpretty_print_commit(CMIT_FMT_USERFORMAT, commit, &ufbuf, &ctx);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/cache.h b/cache.h\nindex 5b896d9..bf639f7 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -829,7 +829,7 @@ extern struct object *peel_to_type(const char *name, int namelen,\n \t\t\t\t   struct object *o, enum object_type);\n \n enum date_mode {\n-\tDATE_NORMAL = 0,\n+\tDATE_DEFAULT = 0,\n \tDATE_RELATIVE,\n \tDATE_SHORT,\n \tDATE_LOCAL,\ndiff --git a/date.c b/date.c\nindex 00f9eb5..096468f 100644\n--- a/date.c\n+++ b/date.c\n@@ -669,7 +669,7 @@ enum date_mode parse_date_format(const char *format)\n \telse if (!strcmp(format, \"local\"))\n \t\treturn DATE_LOCAL;\n \telse if (!strcmp(format, \"default\"))\n-\t\treturn DATE_NORMAL;\n+\t\treturn DATE_DEFAULT;\n \telse if (!strcmp(format, \"raw\"))\n \t\treturn DATE_RAW;\n \telse\ndiff --git a/log-tree.c b/log-tree.c\nindex 2a1e3a9..b059446 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -272,7 +272,7 @@ void get_patch_filename(struct commit *commit, int nr, const char *suffix,\n \tif (commit) {\n \t\tint max_len = start_len + FORMAT_PATCH_NAME_MAX - suffix_len;\n \t\tstruct pretty_print_context ctx = {0};\n-\t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.date_mode = DATE_DEFAULT;\n \n \t\tformat_commit_message(commit, \"%f\", buf, &ctx);\n \t\tif (max_len < buf->len)\n@@ -465,9 +465,9 @@ void show_log(struct rev_info *opt)\n \t\t\t */\n \t\t\tshow_reflog_message(opt->reflog_info,\n \t\t\t\t    opt->commit_format == CMIT_FMT_ONELINE,\n-\t\t\t\t    opt->date_mode_explicit ?\n+\t\t\t\t    opt->date_mode_from_command_line ?\n \t\t\t\t\topt->date_mode :\n-\t\t\t\t\tDATE_NORMAL);\n+\t\t\t\t\tDATE_DEFAULT);\n \t\t\tif (opt->commit_format == CMIT_FMT_ONELINE)\n \t\t\t\treturn;\n \t\t}\ndiff --git a/revision.c b/revision.c\nindex 541f09e..462c311 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1434,10 +1434,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t\trevs->simplify_history = 0;\n \t} else if (!strcmp(arg, \"--relative-date\")) {\n \t\trevs->date_mode = DATE_RELATIVE;\n-\t\trevs->date_mode_explicit = 1;\n+\t\trevs->date_mode_from_command_line = 1;\n \t} else if ((argcount = parse_long_opt(\"date\", argv, &optarg))) {\n \t\trevs->date_mode = parse_date_format(optarg);\n-\t\trevs->date_mode_explicit = 1;\n+\t\trevs->date_mode_from_command_line = 1;\n \t\treturn argcount;\n \t} else if (!strcmp(arg, \"--log-size\")) {\n \t\trevs->show_log_size = 1;\ndiff --git a/revision.h b/revision.h\nindex 9fd8f30..e5ca939 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -92,7 +92,7 @@ struct rev_info {\n \t\t\tabbrev_commit:1,\n \t\t\tuse_terminator:1,\n \t\t\tmissing_newline:1,\n-\t\t\tdate_mode_explicit:1;\n+\t\t\tdate_mode_from_command_line:1;\n \tunsigned int\tdisable_stdin:1;\n \n \tenum date_mode date_mode;\ndiff --git a/submodule.c b/submodule.c\nindex 5294cef..0a45da9 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -605,7 +605,7 @@ static void print_commit(struct commit *commit)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct pretty_print_context ctx = {0};\n-\tctx.date_mode = DATE_NORMAL;\n+\tctx.date_mode = DATE_DEFAULT;\n \tformat_commit_message(commit, \" %h: %m %s\", &sb, &ctx);\n \tfprintf(stderr, \"%s\\n\", sb.buf);\n \tstrbuf_release(&sb);\n-- \n1.7.4.18.g68fe8\n"},{"id":"166119","messageId":"acbcf231-e0a6-440e-be42-5f25da3e318d-mfwitten@gmail.com","threadId":"27144","inReplyTo":"0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com","subject":"[RFC 2/5] Pretty Print: show tz when using DATE_LOCAL","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T02:45:15Z","receivedAt":"2011-04-20T02:45:15Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"Date: Fri, 11 Feb 2011 16:06:36 +0000\nCurrently, when the date mode is DATE_LOCAL, the\ntime zone is never pretty printed; this seems\nto be an unnecessary pecularliarity, especially\nwhen the time zone data could be useful to\nthe user.\n\nThis commit removes that special handling of\ntime zones.\n\nNow, for instance, fast-import.c's write_crash_report()\nwill produce reports that provide more meaningful\ndates.\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n date.c                  |    3 +--\n t/t6300-for-each-ref.sh |    4 ++--\n 2 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/date.c b/date.c\nindex 096468f..caa14fe 100644\n--- a/date.c\n+++ b/date.c\n@@ -186,13 +186,12 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)\n \t\t\tmonth_names[tm->tm_mon], tm->tm_year + 1900,\n \t\t\ttm->tm_hour, tm->tm_min, tm->tm_sec, tz);\n \telse\n-\t\tsprintf(timebuf, \"%.3s %.3s %d %02d:%02d:%02d %d%c%+05d\",\n+\t\tsprintf(timebuf, \"%.3s %.3s %d %02d:%02d:%02d %d %+05d\",\n \t\t\t\tweekday_names[tm->tm_wday],\n \t\t\t\tmonth_names[tm->tm_mon],\n \t\t\t\ttm->tm_mday,\n \t\t\t\ttm->tm_hour, tm->tm_min, tm->tm_sec,\n \t\t\t\ttm->tm_year + 1900,\n-\t\t\t\t(mode == DATE_LOCAL) ? 0 : ' ',\n \t\t\t\ttz);\n \treturn timebuf;\n }\ndiff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh\nindex 7dc8a51..050ed7d 100755\n--- a/t/t6300-for-each-ref.sh\n+++ b/t/t6300-for-each-ref.sh\n@@ -175,8 +175,8 @@ test_expect_success 'Check format \"short\" date fields output' '\n '\n \n cat >expected <<\\EOF\n-'refs/heads/master' 'Mon Jul 3 15:18:43 2006' 'Mon Jul 3 15:18:44 2006'\n-'refs/tags/testtag' 'Mon Jul 3 15:18:45 2006'\n+'refs/heads/master' 'Mon Jul 3 15:18:43 2006 +0000' 'Mon Jul 3 15:18:44 2006 +0000'\n+'refs/tags/testtag' 'Mon Jul 3 15:18:45 2006 +0000'\n EOF\n \n test_expect_success 'Check format \"local\" date fields output' '\n-- \n1.7.4.18.g68fe8\n"},{"id":"166120","messageId":"4e4fea2a-c9fe-47ff-b947-64aa4662adae-mfwitten@gmail.com","threadId":"27144","inReplyTo":"0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com","subject":"[RFC 3/5] Date Mode: Implementation","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T02:45:18Z","receivedAt":"2011-04-20T02:45:18Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"Date: Sat, 12 Feb 2011 03:56:17 +0000\nThis introduces and employs infrastructure for manipulating\nand bundling time zone and date format specifications in\ncode, on the command line, and in git configuration files.\n\nIn particular, this commit includes the following:\n\n  * `struct date_mode' along with functions and macros for\n     working with it.\n\n  *  The new `--time-zone' option (which takes as a value\n     either `default' or `local').\n\n  *  The new date-type mode specifiers `@default' and `@local'\n     for use with the formats of \"git for-each-ref\".\n\n  *  The configuration variables `log.timezone' and\n    `blame.timezone' and the functions for handling their\n     parsing.\n\nMoreover, the value `local' for a date mode format has\nbeen deprecated in favor of the value `local' for a\ndate mode time zone; a use of the deprecated `local'\nformat causes an informational warning to be emitted\non stderr (though this message might be missed quite\neasily due to further normal output on stdout).\n\nEssentially, what was:\n\n  git log --date=local\n\nshould now be:\n\n  git log --time-zone=local\n\nor, perhaps more accurately (depending on what the\nactual unspecified date mode format is):\n\n  git log --date=default --time-zone=local\n\nThe other valid time zone value is `default', which\nspecifies that the time zone stored by git be used.\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n archive.c              |    2 +-\n builtin/blame.c        |   23 +++++++-------\n builtin/cat-file.c     |    3 +-\n builtin/commit.c       |    2 +-\n builtin/for-each-ref.c |   65 +++++++++++++++++++++++++++++----------\n builtin/log.c          |   17 ++++++----\n builtin/shortlog.c     |    2 +-\n builtin/show-branch.c  |    3 +-\n cache.h                |   39 +++++++++++++++++++++--\n commit.h               |    4 +-\n date.c                 |   79 +++++++++++++++++++++++++++++++++++++++++++-----\n fast-import.c          |    4 ++-\n http-backend.c         |    3 +-\n log-tree.c             |   10 ++++--\n pretty.c               |   18 +++++++----\n reflog-walk.c          |    6 ++--\n reflog-walk.h          |    4 +-\n refs.c                 |    6 ++-\n revision.c             |   11 ++++--\n revision.h             |    4 +-\n sha1_name.c            |    5 ++-\n submodule.c            |    2 +-\n test-date.c            |   11 ++++--\n 23 files changed, 236 insertions(+), 87 deletions(-)\n\ndiff --git a/archive.c b/archive.c\nindex dd871ca..cb3e731 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -32,7 +32,7 @@ static void format_subst(const struct commit *commit,\n \tchar *to_free = NULL;\n \tstruct strbuf fmt = STRBUF_INIT;\n \tstruct pretty_print_context ctx = {0};\n-\tctx.date_mode = DATE_DEFAULT;\n+\tSET_DATE_MODE_DEFAULT(ctx.date_mode);\n \tctx.abbrev = DEFAULT_ABBREV;\n \n \tif (src == buf->buf)\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex dd597f4..c28d870 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -43,8 +43,8 @@ static int incremental;\n static int xdl_opts;\n static int abbrev = -1;\n \n-static enum date_mode blame_date_mode = DATE_ISO8601;\n static size_t blame_date_width;\n+static struct date_mode blame_date_mode = INIT_DATE_MODE_FORMAT(DATE_ISO8601);\n \n static struct string_list mailmap;\n \n@@ -2023,6 +2023,8 @@ static void prepare_blame_range(struct scoreboard *sb,\n \n static int git_blame_config(const char *var, const char *value, void *cb)\n {\n+\tint ret;\n+\n \tif (!strcmp(var, \"blame.showroot\")) {\n \t\tshow_root = git_config_bool(var, value);\n \t\treturn 0;\n@@ -2031,12 +2033,9 @@ static int git_blame_config(const char *var, const char *value, void *cb)\n \t\tblank_boundary = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n-\tif (!strcmp(var, \"blame.date\")) {\n-\t\tif (!value)\n-\t\t\treturn config_error_nonbool(var);\n-\t\tblame_date_mode = parse_date_format(value);\n-\t\treturn 0;\n-\t}\n+\n+\tif (parse_date_mode_config(\"blame\", var, value, &blame_date_mode, &ret))\n+\t\treturn ret;\n \n \tswitch (userdiff_config(var, value)) {\n \tcase 0:\n@@ -2347,6 +2346,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n parse_done:\n \targc = parse_options_end(&ctx);\n \n+\tsanitize_date_mode(\"blame\", &revs.date_mode);\n+\n \tif (abbrev == -1)\n \t\tabbrev = default_abbrev;\n \t/* one more abbrev length is needed for the boundary commit */\n@@ -2357,13 +2358,13 @@ parse_done:\n \n \tif (cmd_is_annotate) {\n \t\toutput_option |= OUTPUT_ANNOTATE_COMPAT;\n-\t\tblame_date_mode = DATE_ISO8601;\n+\t\tblame_date_mode.format = DATE_ISO8601;\n \t} else {\n \t\tblame_date_mode = revs.date_mode;\n \t}\n \n \t/* The maximum width used to show the dates */\n-\tswitch (blame_date_mode) {\n+\tswitch (blame_date_mode.format) {\n \tcase DATE_RFC2822:\n \t\tblame_date_width = sizeof(\"Thu, 19 Oct 2006 16:00:04 -0700\");\n \t\tbreak;\n@@ -2376,9 +2377,7 @@ parse_done:\n \tcase DATE_SHORT:\n \t\tblame_date_width = sizeof(\"2006-10-19\");\n \t\tbreak;\n-\tcase DATE_RELATIVE:\n-\tcase DATE_LOCAL:\n-\tcase DATE_DEFAULT:\n+\tdefault:\n \t\tblame_date_width = sizeof(\"Thu Oct 19 16:00:04 2006 -0700\");\n \t\tbreak;\n \t}\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 94632db..2252c83 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -46,6 +46,7 @@ static void pprint_tag(const unsigned char *sha1, const char *buf, unsigned long\n \t\t\t\t\tchar *ep;\n \t\t\t\t\tunsigned long date;\n \t\t\t\t\tlong tz;\n+\t\t\t\t\tstruct date_mode d = INIT_DATE_MODE;\n \t\t\t\t\twhile (sp < cp && *sp != '>')\n \t\t\t\t\t\tsp++;\n \t\t\t\t\tif (sp == cp) {\n@@ -60,7 +61,7 @@ static void pprint_tag(const unsigned char *sha1, const char *buf, unsigned long\n \t\t\t\t\twrite_or_die(1, tagger, sp - tagger);\n \t\t\t\t\tdate = strtoul(sp, &ep, 10);\n \t\t\t\t\ttz = strtol(ep, NULL, 10);\n-\t\t\t\t\tsp = show_date(date, tz, 0);\n+\t\t\t\t\tsp = show_date(date, tz, d);\n \t\t\t\t\twrite_or_die(1, sp, strlen(sp));\n \t\t\t\t\txwrite(1, \"\\n\", 1);\n \t\t\t\t\tbreak;\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 194db99..79343c4 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -933,7 +933,7 @@ static const char *find_author_by_nickname(const char *name)\n \tcommit = get_revision(&revs);\n \tif (commit) {\n \t\tstruct pretty_print_context ctx = {0};\n-\t\tctx.date_mode = DATE_DEFAULT;\n+\t\tSET_DATE_MODE_DEFAULT(ctx.date_mode);\n \t\tstrbuf_release(&buf);\n \t\tformat_commit_message(commit, \"%an <%ae>\", &buf, &ctx);\n \t\treturn strbuf_detach(&buf, NULL);\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex 60d6b32..add9299 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -118,9 +118,8 @@ static int parse_atom(const char *atom, const char *ep)\n \t\t * shouldn't be used for checking against the valid_atom\n \t\t * table.\n \t\t */\n-\t\tconst char *formatp = strchr(sp, ':');\n-\t\tif (!formatp || ep < formatp)\n-\t\t\tformatp = ep;\n+\t\tconst char *formatp = sp;\n+\t\tfor (; formatp < ep && *formatp != ':' && *formatp != '@'; ++formatp);\n \t\tif (len == formatp - sp && !memcmp(valid_atom[i].name, sp, len))\n \t\t\tbreak;\n \t}\n@@ -361,26 +360,58 @@ static const char *copy_email(const char *buf)\n \treturn xmemdupz(email, eoemail + 1 - email);\n }\n \n+#define PARSE_DATE_MODE(marker_0, parser_0, date_mode_member_0, \\\n+                        marker_1, parser_1, date_mode_member_1) \\\n+\tif (*atomname == marker_0) { \\\n+\t\tconst char *spec_0 = ++atomname; \\\n+\t\tdo { \\\n+\t\t\tif (*atomname == marker_1) { \\\n+\t\t\t\tdate_mode_member_1 = parser_1(atomname+1); \\\n+\t\t\t\tchar *spec_0_dup  = xmemdupz(spec_0, atomname - spec_0); \\\n+\t\t\t\tdate_mode_member_0 = parser_0(spec_0_dup); \\\n+\t\t\t\tfree(spec_0_dup); \\\n+\t\t\t\tgoto finish; \\\n+\t\t\t} \\\n+\t\t} while (*++atomname); \\\n+\t\tdate_mode_member_0 = parser_0(spec_0); \\\n+\t\tgoto finish; \\\n+\t}\n+\n+static void parse_date_mode(const char *atomname, struct date_mode *date_mode)\n+{\n+\tstatic int need_to_warn = 1;\n+\n+\tdo {\n+\t\t/* :date_format@time_zone */\n+\t\tPARSE_DATE_MODE(':', parse_date_format, date_mode->format,\n+\t\t                '@', parse_time_zone,   date_mode->zone);\n+\n+\t\t/* @time_zone:date_format */\n+\t\tPARSE_DATE_MODE('@', parse_time_zone,   date_mode->zone,\n+\t\t                ':', parse_date_format, date_mode->format);\n+\n+\t} while (*++atomname);\n+\n+finish:\n+\n+\tif (sanitize_date_mode(NULL, date_mode) && need_to_warn) {\n+\t\tneed_to_warn = 0;\n+\t\twarning(\"The date format `:local' is deprecated; \"\n+\t\t        \"use the time zone specifier `@local' instead.\");\n+\t}\n+}\n+\n+#undef PARSE_DATE_MODE\n+\n static void grab_date(const char *buf, struct atom_value *v, const char *atomname)\n {\n \tconst char *eoemail = strstr(buf, \"> \");\n \tchar *zone;\n \tunsigned long timestamp;\n \tlong tz;\n-\tenum date_mode date_mode = DATE_DEFAULT;\n-\tconst char *formatp;\n+\tstruct date_mode date_mode = INIT_DATE_MODE;\n \n-\t/*\n-\t * We got here because atomname ends in \"date\" or \"date<something>\";\n-\t * it's not possible that <something> is not \":<format>\" because\n-\t * parse_atom() wouldn't have allowed it, so we can assume that no\n-\t * \":\" means no format is specified, and use the default.\n-\t */\n-\tformatp = strchr(atomname, ':');\n-\tif (formatp != NULL) {\n-\t\tformatp++;\n-\t\tdate_mode = parse_date_format(formatp);\n-\t}\n+\tparse_date_mode(atomname, &date_mode);\n \n \tif (!eoemail)\n \t\tgoto bad;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex d43ad3a..fd6b212 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -20,8 +20,7 @@\n #include \"string-list.h\"\n #include \"parse-options.h\"\n \n-/* Set a default date-time format for git log (\"log.date\" config variable) */\n-static const char *default_date_mode = NULL;\n+static struct date_mode default_date_mode = INIT_DATE_MODE;\n \n static int default_show_root = 1;\n static int decoration_style;\n@@ -61,8 +60,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)\n \trev->subject_prefix = fmt_patch_subject_prefix;\n \tDIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);\n \n-\tif (default_date_mode)\n-\t\trev->date_mode = parse_date_format(default_date_mode);\n+\trev->date_mode = default_date_mode;\n }\n \n static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n@@ -79,6 +77,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n \t\tusage(builtin_log_usage);\n \targc = setup_revisions(argc, argv, rev, opt);\n \n+\tsanitize_date_mode(\"log\", &rev->date_mode);\n+\n \tmemset(&w, 0, sizeof(w));\n \tuserformat_find_requirements(NULL, &w);\n \n@@ -305,12 +305,14 @@ static int cmd_log_walk(struct rev_info *rev)\n \n static int git_log_config(const char *var, const char *value, void *cb)\n {\n+\tint ret;\n+\n \tif (!strcmp(var, \"format.pretty\"))\n \t\treturn git_config_string(&fmt_pretty, var, value);\n \tif (!strcmp(var, \"format.subjectprefix\"))\n \t\treturn git_config_string(&fmt_patch_subject_prefix, var, value);\n-\tif (!strcmp(var, \"log.date\"))\n-\t\treturn git_config_string(&default_date_mode, var, value);\n+\tif (parse_date_mode_config(\"log\", var, value, &default_date_mode, &ret))\n+\t\treturn ret;\n \tif (!strcmp(var, \"log.decorate\")) {\n \t\tdecoration_style = parse_decoration_style(var, value);\n \t\tif (decoration_style < 0)\n@@ -748,6 +750,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \tstruct diff_options opts;\n \tint need_8bit_cte = 0;\n \tstruct commit *commit = NULL;\n+\tstruct date_mode date_mode = INIT_DATE_MODE_FORMAT(DATE_RFC2822);\n \n \tif (rev->commit_format != CMIT_FMT_EMAIL)\n \t\tdie(_(\"Cover letter needs email format\"));\n@@ -787,7 +790,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \t\t\tneed_8bit_cte = 1;\n \n \tmsg = body;\n-\tpp_user_info(NULL, CMIT_FMT_EMAIL, &sb, committer, DATE_RFC2822,\n+\tpp_user_info(NULL, CMIT_FMT_EMAIL, &sb, committer, date_mode,\n \t\t     encoding);\n \tpp_title_line(CMIT_FMT_EMAIL, &msg, &sb, subject_start, extra_headers,\n \t\t      encoding, need_8bit_cte);\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 5815f55..8560847 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -165,7 +165,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.abbrev = log->abbrev;\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n-\t\tctx.date_mode = DATE_DEFAULT;\n+\t\tSET_DATE_MODE_DEFAULT(ctx.date_mode);\n \t\tpretty_print_commit(CMIT_FMT_USERFORMAT, commit, &ufbuf, &ctx);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 1abcd9e..4981db2 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -765,6 +765,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\t\tconst char *msg;\n \t\t\tunsigned long timestamp;\n \t\t\tint tz;\n+\t\t\tstruct date_mode d = INIT_DATE_MODE_FORMAT(DATE_RELATIVE);\n \n \t\t\tif (read_ref_at(ref, 0, base+i, sha1, &logmsg,\n \t\t\t\t\t&timestamp, &tz, NULL)) {\n@@ -778,7 +779,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)\n \t\t\t\tmsg++;\n \t\t\tm = xmalloc(strlen(msg) + 200);\n \t\t\tsprintf(m, \"(%s) %s\",\n-\t\t\t\tshow_date(timestamp, tz, 1),\n+\t\t\t\tshow_date(timestamp, tz, d),\n \t\t\t\tmsg);\n \t\t\treflog_msg[i] = m;\n \t\t\tfree(logmsg);\ndiff --git a/cache.h b/cache.h\nindex bf639f7..910eccf 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -828,17 +828,47 @@ extern void *read_object_with_reference(const unsigned char *sha1,\n extern struct object *peel_to_type(const char *name, int namelen,\n \t\t\t\t   struct object *o, enum object_type);\n \n-enum date_mode {\n+enum date_format {\n \tDATE_DEFAULT = 0,\n \tDATE_RELATIVE,\n \tDATE_SHORT,\n-\tDATE_LOCAL,\n+\tDATE_LOCAL,           /* Deprecated; use TIME_ZONE_LOCAL */\n \tDATE_ISO8601,\n \tDATE_RFC2822,\n \tDATE_RAW\n };\n \n-const char *show_date(unsigned long time, int timezone, enum date_mode mode);\n+enum time_zone {\n+\tTIME_ZONE_DEFAULT = 0,\n+\tTIME_ZONE_LOCAL\n+};\n+\n+struct date_mode {\n+\tenum date_format format;\n+\tenum time_zone zone;\n+};\n+\n+#define INIT_DATE_MODE_FORMAT_AND_ZONE(m,z) { .format = m, .zone = z }\n+#define INIT_DATE_MODE_FORMAT(m) INIT_DATE_MODE_FORMAT_AND_ZONE(m, TIME_ZONE_DEFAULT)\n+#define INIT_DATE_MODE_ZONE(z) INIT_DATE_MODE_FORMAT_AND_ZONE(DATE_DEFAULT, z)\n+#define INIT_DATE_MODE INIT_DATE_MODE_FORMAT_AND_ZONE(DATE_DEFAULT, TIME_ZONE_DEFAULT)\n+#define SET_DATE_MODE_DEFAULT(date_mode)   \\\n+\tdate_mode.format = DATE_DEFAULT; \\\n+\tdate_mode.zone = TIME_ZONE_DEFAULT;\n+\n+int parse_date_mode_config_internal(const char *var_date,\n+                                     const char *var_time_zone,\n+                                     const char *var,\n+                                     const char *value,\n+                                     struct date_mode *d,\n+                                     int *ret);\n+\n+#define parse_date_mode_config(command_name, var, value, date_mode, ret) \\\n+\tparse_date_mode_config_internal(command_name \".date\", command_name \".timezone\", var, value, date_mode, ret)\n+\n+int sanitize_date_mode(const char* command_name, struct date_mode *d);\n+\n+const char *show_date(unsigned long time, int timezone, struct date_mode date_mode);\n const char *show_date_relative(unsigned long time, int tz,\n \t\t\t       const struct timeval *now,\n \t\t\t       char *timebuf,\n@@ -849,7 +879,8 @@ void datestamp(char *buf, int bufsize);\n #define approxidate(s) approxidate_careful((s), NULL)\n unsigned long approxidate_careful(const char *, int *);\n unsigned long approxidate_relative(const char *date, const struct timeval *now);\n-enum date_mode parse_date_format(const char *format);\n+enum date_format parse_date_format(const char *format);\n+enum time_zone parse_time_zone(const char *time_zone);\n \n #define IDENT_WARN_ON_NO_NAME  1\n #define IDENT_ERROR_ON_NO_NAME 2\ndiff --git a/commit.h b/commit.h\nindex 4198513..04b03d1 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -72,7 +72,7 @@ struct pretty_print_context {\n \tint abbrev;\n \tconst char *subject;\n \tconst char *after_subject;\n-\tenum date_mode date_mode;\n+\tstruct date_mode date_mode;\n \tint need_8bit_cte;\n \tint show_notes;\n \tstruct reflog_walk_info *reflog_info;\n@@ -98,7 +98,7 @@ extern void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \t\t\t\tstruct strbuf *sb,\n \t\t\t\tconst struct pretty_print_context *context);\n void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,\n-\t\t   const char *line, enum date_mode dmode,\n+\t\t   const char *line, struct date_mode dmode,\n \t\t   const char *encoding);\n void pp_title_line(enum cmit_fmt fmt,\n \t\t   const char **msg_p,\ndiff --git a/date.c b/date.c\nindex caa14fe..879b0e1 100644\n--- a/date.c\n+++ b/date.c\n@@ -147,40 +147,42 @@ const char *show_date_relative(unsigned long time, int tz,\n \treturn timebuf;\n }\n \n-const char *show_date(unsigned long time, int tz, enum date_mode mode)\n+const char *show_date(unsigned long time, int tz, struct date_mode date_mode)\n {\n \tstruct tm *tm;\n \tstatic char timebuf[200];\n \n-\tif (mode == DATE_RAW) {\n+\tenum date_format format = date_mode.format;\n+\n+\tif (format == DATE_RAW) {\n \t\tsnprintf(timebuf, sizeof(timebuf), \"%lu %+05d\", time, tz);\n \t\treturn timebuf;\n \t}\n \n-\tif (mode == DATE_RELATIVE) {\n+\tif (format == DATE_RELATIVE) {\n \t\tstruct timeval now;\n \t\tgettimeofday(&now, NULL);\n \t\treturn show_date_relative(time, tz, &now,\n \t\t\t\t\t  timebuf, sizeof(timebuf));\n \t}\n \n-\tif (mode == DATE_LOCAL)\n+\tif (date_mode.zone == TIME_ZONE_LOCAL)\n \t\ttz = local_tzoffset(time);\n \n \ttm = time_to_tm(time, tz);\n \tif (!tm)\n \t\treturn NULL;\n-\tif (mode == DATE_SHORT)\n+\tif (format == DATE_SHORT)\n \t\tsprintf(timebuf, \"%04d-%02d-%02d\", tm->tm_year + 1900,\n \t\t\t\ttm->tm_mon + 1, tm->tm_mday);\n-\telse if (mode == DATE_ISO8601)\n+\telse if (format == DATE_ISO8601)\n \t\tsprintf(timebuf, \"%04d-%02d-%02d %02d:%02d:%02d %+05d\",\n \t\t\t\ttm->tm_year + 1900,\n \t\t\t\ttm->tm_mon + 1,\n \t\t\t\ttm->tm_mday,\n \t\t\t\ttm->tm_hour, tm->tm_min, tm->tm_sec,\n \t\t\t\ttz);\n-\telse if (mode == DATE_RFC2822)\n+\telse if (format == DATE_RFC2822)\n \t\tsprintf(timebuf, \"%.3s, %d %.3s %d %02d:%02d:%02d %+05d\",\n \t\t\tweekday_names[tm->tm_wday], tm->tm_mday,\n \t\t\tmonth_names[tm->tm_mon], tm->tm_year + 1900,\n@@ -653,7 +655,7 @@ int parse_date(const char *date, char *result, int maxlen)\n \treturn date_string(timestamp, offset, result, maxlen);\n }\n \n-enum date_mode parse_date_format(const char *format)\n+enum date_format parse_date_format(const char *format)\n {\n \tif (!strcmp(format, \"relative\"))\n \t\treturn DATE_RELATIVE;\n@@ -675,6 +677,67 @@ enum date_mode parse_date_format(const char *format)\n \t\tdie(\"unknown date format %s\", format);\n }\n \n+enum time_zone parse_time_zone(const char *time_zone)\n+{\n+\tif (!strcmp(time_zone, \"local\"))\n+\t\treturn TIME_ZONE_LOCAL;\n+\telse if (!strcmp(time_zone, \"default\"))\n+\t\treturn TIME_ZONE_DEFAULT;\n+\telse\n+\t\tdie(\"unknown time zone %s\", time_zone);\n+}\n+\n+int parse_date_mode_config_internal(const char *var_date,\n+                                     const char *var_timezone,\n+                                     const char *var,\n+                                     const char *value,\n+                                     struct date_mode *d,\n+                                     int *ret)\n+{\n+\tif (!strcmp(var, var_date)) {\n+\t\tif (!value)\n+\t\t\t*ret = config_error_nonbool(var);\n+\n+\t\td->format = parse_date_format(value);\n+\n+\t\treturn 1;\n+\t}\n+\n+\tif (!strcmp(var, var_timezone)) {\n+\t\tif (!value)\n+\t\t\t*ret = config_error_nonbool(var);\n+\n+\t\td->zone = parse_time_zone(value);\n+\n+\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int sanitize_date_mode(const char* command_name, struct date_mode *d)\n+{\n+\tif (d->format == DATE_LOCAL) {\n+\t\tif (command_name)\n+\t\t\twarning(\"The following are now deprecated:\\n\\n\"\n+\t\t\t        \"    %s.date = local\\n\"\n+\t\t\t        \"    --date=local\\n\\n\"\n+\t\t\t        \"Use these instead:\\n\\n\"\n+\t\t\t        \"    %s.timezone = local\\n\"\n+\t\t\t        \"    --time-zone=local\\n\\n\"\n+\t\t\t        \"Now assuming you meant:\\n\\n\"\n+\t\t\t        \"    --date=default --time-zone=local\",\n+\t\t\t        command_name, command_name);\n+\n+\t\td->format = DATE_DEFAULT;\n+\t\td->zone = TIME_ZONE_LOCAL;\n+\n+\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n void datestamp(char *buf, int bufsize)\n {\n \ttime_t now;\ndiff --git a/fast-import.c b/fast-import.c\nindex 3e4e655..bd5c113 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -401,6 +401,8 @@ static void write_crash_report(const char *err)\n \tunsigned long lu;\n \tstruct recent_command *rc;\n \n+\tstruct date_mode date_mode = INIT_DATE_MODE_ZONE(TIME_ZONE_LOCAL);\n+\n \tif (!rpt) {\n \t\terror(\"can't write crash report %s: %s\", loc, strerror(errno));\n \t\treturn;\n@@ -411,7 +413,7 @@ static void write_crash_report(const char *err)\n \tfprintf(rpt, \"fast-import crash report:\\n\");\n \tfprintf(rpt, \"    fast-import process: %\"PRIuMAX\"\\n\", (uintmax_t) getpid());\n \tfprintf(rpt, \"    parent process     : %\"PRIuMAX\"\\n\", (uintmax_t) getppid());\n-\tfprintf(rpt, \"    at %s\\n\", show_date(time(NULL), 0, DATE_LOCAL));\n+\tfprintf(rpt, \"    at %s\\n\", show_date(time(NULL), 0, date_mode));\n \tfputc('\\n', rpt);\n \n \tfputs(\"fatal: \", rpt);\ndiff --git a/http-backend.c b/http-backend.c\nindex 8501504..15794c9 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -89,7 +89,8 @@ static void hdr_int(const char *name, uintmax_t value)\n \n static void hdr_date(const char *name, unsigned long when)\n {\n-\tconst char *value = show_date(when, 0, DATE_RFC2822);\n+\tstruct date_mode d = INIT_DATE_MODE_FORMAT(DATE_RFC2822);\n+\tconst char *value = show_date(when, 0, d);\n \thdr_str(name, value);\n }\n \ndiff --git a/log-tree.c b/log-tree.c\nindex b059446..3a6e110 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -272,7 +272,7 @@ void get_patch_filename(struct commit *commit, int nr, const char *suffix,\n \tif (commit) {\n \t\tint max_len = start_len + FORMAT_PATCH_NAME_MAX - suffix_len;\n \t\tstruct pretty_print_context ctx = {0};\n-\t\tctx.date_mode = DATE_DEFAULT;\n+\t\tSET_DATE_MODE_DEFAULT(ctx.date_mode);\n \n \t\tformat_commit_message(commit, \"%f\", buf, &ctx);\n \t\tif (max_len < buf->len)\n@@ -463,11 +463,13 @@ void show_log(struct rev_info *opt)\n \t\t\t * so we don't need to worry about printing the\n \t\t\t * graph info here.\n \t\t\t */\n+\n+\t\t\tif (!opt->date_format_from_command_line)\n+\t\t\t\topt->date_mode.format = DATE_DEFAULT;\n+\n \t\t\tshow_reflog_message(opt->reflog_info,\n \t\t\t\t    opt->commit_format == CMIT_FMT_ONELINE,\n-\t\t\t\t    opt->date_mode_from_command_line ?\n-\t\t\t\t\topt->date_mode :\n-\t\t\t\t\tDATE_DEFAULT);\n+\t\t\t\t    opt->date_mode);\n \t\t\tif (opt->commit_format == CMIT_FMT_ONELINE)\n \t\t\t\treturn;\n \t\t}\ndiff --git a/pretty.c b/pretty.c\nindex e1d8a8f..d702575 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -267,7 +267,7 @@ needquote:\n }\n \n void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,\n-\t\t  const char *line, enum date_mode dmode,\n+\t\t  const char *line, struct date_mode dmode,\n \t\t  const char *encoding)\n {\n \tchar *date;\n@@ -306,7 +306,8 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,\n \t\tstrbuf_addf(sb, \"Date:   %s\\n\", show_date(time, tz, dmode));\n \t\tbreak;\n \tcase CMIT_FMT_EMAIL:\n-\t\tstrbuf_addf(sb, \"Date: %s\\n\", show_date(time, tz, DATE_RFC2822));\n+\t\tdmode.format = DATE_RFC2822;\n+\t\tstrbuf_addf(sb, \"Date: %s\\n\", show_date(time, tz, dmode));\n \t\tbreak;\n \tcase CMIT_FMT_FULLER:\n \t\tstrbuf_addf(sb, \"%sDate: %s\\n\", what, show_date(time, tz, dmode));\n@@ -458,7 +459,7 @@ static int mailmap_name(char *email, int email_len, char *name, int name_len)\n }\n \n static size_t format_person_part(struct strbuf *sb, char part,\n-\t\t\t\t const char *msg, int len, enum date_mode dmode)\n+\t\t\t\t const char *msg, int len, struct date_mode dmode)\n {\n \t/* currently all placeholders have same length */\n \tconst int placeholder_len = 2;\n@@ -540,13 +541,16 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \t\tstrbuf_addstr(sb, show_date(date, tz, dmode));\n \t\treturn placeholder_len;\n \tcase 'D':\t/* date, RFC2822 style */\n-\t\tstrbuf_addstr(sb, show_date(date, tz, DATE_RFC2822));\n+\t\tdmode.format = DATE_RFC2822;\n+\t\tstrbuf_addstr(sb, show_date(date, tz, dmode));\n \t\treturn placeholder_len;\n \tcase 'r':\t/* date, relative */\n-\t\tstrbuf_addstr(sb, show_date(date, tz, DATE_RELATIVE));\n+\t\tdmode.format = DATE_RELATIVE;\n+\t\tstrbuf_addstr(sb, show_date(date, tz, dmode));\n \t\treturn placeholder_len;\n \tcase 'i':\t/* date, ISO 8601 */\n-\t\tstrbuf_addstr(sb, show_date(date, tz, DATE_ISO8601));\n+\t\tdmode.format = DATE_ISO8601;\n+\t\tstrbuf_addstr(sb, show_date(date, tz, dmode));\n \t\treturn placeholder_len;\n \t}\n \n@@ -1050,7 +1054,7 @@ void format_commit_message(const struct commit *commit,\n \n static void pp_header(enum cmit_fmt fmt,\n \t\t      int abbrev,\n-\t\t      enum date_mode dmode,\n+\t\t      struct date_mode dmode,\n \t\t      const char *encoding,\n \t\t      const struct commit *commit,\n \t\t      const char **msg_p,\ndiff --git a/reflog-walk.c b/reflog-walk.c\nindex 5d81d39..e1bc64a 100644\n--- a/reflog-walk.c\n+++ b/reflog-walk.c\n@@ -243,7 +243,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)\n \n void get_reflog_selector(struct strbuf *sb,\n \t\t\t struct reflog_walk_info *reflog_info,\n-\t\t\t enum date_mode dmode,\n+\t\t\t struct date_mode dmode,\n \t\t\t int shorten)\n {\n \tstruct commit_reflog *commit_reflog = reflog_info->last_commit_reflog;\n@@ -263,7 +263,7 @@ void get_reflog_selector(struct strbuf *sb,\n \t}\n \n \tstrbuf_addf(sb, \"%s@{\", printed_ref);\n-\tif (commit_reflog->flag || dmode) {\n+\tif (commit_reflog->flag || dmode.format) {\n \t\tinfo = &commit_reflog->reflogs->items[commit_reflog->recno+1];\n \t\tstrbuf_addstr(sb, show_date(info->timestamp, info->tz, dmode));\n \t} else {\n@@ -292,7 +292,7 @@ void get_reflog_message(struct strbuf *sb,\n }\n \n void show_reflog_message(struct reflog_walk_info *reflog_info, int oneline,\n-\tenum date_mode dmode)\n+\tstruct date_mode dmode)\n {\n \tif (reflog_info && reflog_info->last_commit_reflog) {\n \t\tstruct commit_reflog *commit_reflog = reflog_info->last_commit_reflog;\ndiff --git a/reflog-walk.h b/reflog-walk.h\nindex 7bd2cd4..30805cc 100644\n--- a/reflog-walk.h\n+++ b/reflog-walk.h\n@@ -11,12 +11,12 @@ extern int add_reflog_for_walk(struct reflog_walk_info *info,\n extern void fake_reflog_parent(struct reflog_walk_info *info,\n \t\tstruct commit *commit);\n extern void show_reflog_message(struct reflog_walk_info *info, int,\n-\t\tenum date_mode);\n+\t\tstruct date_mode);\n extern void get_reflog_message(struct strbuf *sb,\n \t\tstruct reflog_walk_info *reflog_info);\n extern void get_reflog_selector(struct strbuf *sb,\n \t\tstruct reflog_walk_info *reflog_info,\n-\t\tenum date_mode dmode,\n+\t\tstruct date_mode dmode,\n \t\tint shorten);\n \n #endif\ndiff --git a/refs.c b/refs.c\nindex e3c0511..75ad7e6 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -1633,8 +1633,9 @@ int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *\n \t\t\t\tif (get_sha1_hex(rec + 41, sha1))\n \t\t\t\t\tdie(\"Log %s is corrupt.\", logfile);\n \t\t\t\tif (hashcmp(logged_sha1, sha1)) {\n+\t\t\t\t\tstruct date_mode d = INIT_DATE_MODE_FORMAT(DATE_RFC2822);\n \t\t\t\t\twarning(\"Log %s has gap after %s.\",\n-\t\t\t\t\t\tlogfile, show_date(date, tz, DATE_RFC2822));\n+\t\t\t\t\t\tlogfile, show_date(date, tz, d));\n \t\t\t\t}\n \t\t\t}\n \t\t\telse if (date == at_time) {\n@@ -1645,8 +1646,9 @@ int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *\n \t\t\t\tif (get_sha1_hex(rec + 41, logged_sha1))\n \t\t\t\t\tdie(\"Log %s is corrupt.\", logfile);\n \t\t\t\tif (hashcmp(logged_sha1, sha1)) {\n+\t\t\t\t\tstruct date_mode d = INIT_DATE_MODE_FORMAT(DATE_RFC2822);\n \t\t\t\t\twarning(\"Log %s unexpectedly ended on %s.\",\n-\t\t\t\t\t\tlogfile, show_date(date, tz, DATE_RFC2822));\n+\t\t\t\t\t\tlogfile, show_date(date, tz, d));\n \t\t\t\t}\n \t\t\t}\n \t\t\tmunmap(log_mapped, mapsz);\ndiff --git a/revision.c b/revision.c\nindex 462c311..fd87c67 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1433,11 +1433,14 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg\n \t} else if (!strcmp(arg, \"--full-history\")) {\n \t\trevs->simplify_history = 0;\n \t} else if (!strcmp(arg, \"--relative-date\")) {\n-\t\trevs->date_mode = DATE_RELATIVE;\n-\t\trevs->date_mode_from_command_line = 1;\n+\t\trevs->date_mode.format = DATE_RELATIVE;\n+\t\trevs->date_format_from_command_line = 1;\n \t} else if ((argcount = parse_long_opt(\"date\", argv, &optarg))) {\n-\t\trevs->date_mode = parse_date_format(optarg);\n-\t\trevs->date_mode_from_command_line = 1;\n+\t\trevs->date_mode.format = parse_date_format(optarg);\n+\t\trevs->date_format_from_command_line = 1;\n+\t\treturn argcount;\n+\t} else if ((argcount = parse_long_opt(\"time-zone\", argv, &optarg))) {\n+\t\trevs->date_mode.zone = parse_time_zone(optarg);\n \t\treturn argcount;\n \t} else if (!strcmp(arg, \"--log-size\")) {\n \t\trevs->show_log_size = 1;\ndiff --git a/revision.h b/revision.h\nindex e5ca939..0ced0fb 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -92,10 +92,10 @@ struct rev_info {\n \t\t\tabbrev_commit:1,\n \t\t\tuse_terminator:1,\n \t\t\tmissing_newline:1,\n-\t\t\tdate_mode_from_command_line:1;\n+\t\t\tdate_format_from_command_line:1;\n \tunsigned int\tdisable_stdin:1;\n \n-\tenum date_mode date_mode;\n+\tstruct date_mode date_mode;\n \n \tunsigned int\tabbrev;\n \tenum cmit_fmt\tcommit_format;\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 69cd6c8..718093c 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -428,9 +428,12 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)\n \t\tif (read_ref_at(real_ref, at_time, nth, sha1, NULL,\n \t\t\t\t&co_time, &co_tz, &co_cnt)) {\n \t\t\tif (at_time)\n+\t\t\t{\n+\t\t\t\tstruct date_mode d = INIT_DATE_MODE_FORMAT(DATE_RFC2822);\n \t\t\t\twarning(\"Log for '%.*s' only goes \"\n \t\t\t\t\t\"back to %s.\", len, str,\n-\t\t\t\t\tshow_date(co_time, co_tz, DATE_RFC2822));\n+\t\t\t\t\tshow_date(co_time, co_tz, d));\n+\t\t\t}\n \t\t\telse {\n \t\t\t\tfree(real_ref);\n \t\t\t\tdie(\"Log for '%.*s' only has %d entries.\",\ndiff --git a/submodule.c b/submodule.c\nindex 0a45da9..f61a0a2 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -605,7 +605,7 @@ static void print_commit(struct commit *commit)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct pretty_print_context ctx = {0};\n-\tctx.date_mode = DATE_DEFAULT;\n+\tSET_DATE_MODE_DEFAULT(ctx.date_mode);\n \tformat_commit_message(commit, \" %h: %m %s\", &sb, &ctx);\n \tfprintf(stderr, \"%s\\n\", sb.buf);\n \tstrbuf_release(&sb);\ndiff --git a/test-date.c b/test-date.c\nindex 6bcd5b0..6d49c2d 100644\n--- a/test-date.c\n+++ b/test-date.c\n@@ -26,8 +26,11 @@ static void parse_dates(char **argv, struct timeval *now)\n \t\tresult[0] = 0;\n \t\tparse_date(*argv, result, sizeof(result));\n \t\tif (sscanf(result, \"%lu %d\", &t, &tz) == 2)\n+\t\t{\n+\t\t\tstruct date_mode d = INIT_DATE_MODE_FORMAT(DATE_ISO8601);\n \t\t\tprintf(\"%s -> %s\\n\",\n-\t\t\t       *argv, show_date(t, tz, DATE_ISO8601));\n+\t\t\t       *argv, show_date(t, tz, d));\n+\t\t}\n \t\telse\n \t\t\tprintf(\"%s -> bad\\n\", *argv);\n \t}\n@@ -36,9 +39,9 @@ static void parse_dates(char **argv, struct timeval *now)\n static void parse_approxidate(char **argv, struct timeval *now)\n {\n \tfor (; *argv; argv++) {\n-\t\ttime_t t;\n-\t\tt = approxidate_relative(*argv, now);\n-\t\tprintf(\"%s -> %s\\n\", *argv, show_date(t, 0, DATE_ISO8601));\n+\t\ttime_t t = approxidate_relative(*argv, now);\n+\t\tstruct date_mode d = INIT_DATE_MODE_FORMAT(DATE_ISO8601);\n+\t\tprintf(\"%s -> %s\\n\", *argv, show_date(t, 0, d));\n \t}\n }\n \n-- \n1.7.4.18.g68fe8\n"},{"id":"166121","messageId":"7671f2f1-73d3-4978-ba1c-54e5dcaecadb-mfwitten@gmail.com","threadId":"27144","inReplyTo":"0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com","subject":"[RFC 4/5] Date Mode: Documentation","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T02:45:20Z","receivedAt":"2011-04-20T02:45:20Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"Date: Tue, 19 Apr 2011 19:06:02 +0000\nThis commit updates the git documentation to reflect the new\ndate mode time zone features. As a result, the common date\nmode documentation has been factored out into one file:\n\n  Documentation/date-mode-docs.txt\n\nwhich is included where necessary (sometimes with attribute\nreference substitutions); this file is somewhat messy at\nfirst glance (AsciiDoc is difficult to tame), but now all\nof the essential information is centralized and quite\nmodular.\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n Documentation/blame-options.txt    |    9 +---\n Documentation/config.txt           |   32 +++++++------\n Documentation/date-mode-docs.txt   |   87 ++++++++++++++++++++++++++++++++++++\n Documentation/git-for-each-ref.txt |   19 +++++++-\n Documentation/git-log.txt          |   43 ------------------\n Documentation/git-rev-list.txt     |    4 +-\n Documentation/git-svn.txt          |    2 +-\n Documentation/rev-list-options.txt |   28 +-----------\n 8 files changed, 128 insertions(+), 96 deletions(-)\n create mode 100644 Documentation/date-mode-docs.txt\n\ndiff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt\nindex 16e3c68..deb824e 100644\n--- a/Documentation/blame-options.txt\n+++ b/Documentation/blame-options.txt\n@@ -70,13 +70,8 @@ of lines before or after the line given by <start>.\n \ttree copy has the contents of the named file (specify\n \t`-` to make the command read from the standard input).\n \n---date <format>::\n-\tThe value is one of the following alternatives:\n-\t{relative,local,default,iso,rfc,short}. If --date is not\n-\tprovided, the value of the blame.date config variable is\n-\tused. If the blame.date config variable is also not set, the\n-\tiso format is used. For more information, See the discussion\n-\tof the --date option at linkgit:git-log[1].\n+:date mode options:\n+include::date-mode-docs.txt[]\n \n -M|<num>|::\n \tDetect moved or copied lines within a file. When a commit\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 480dd0a..5bf9366 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -607,6 +607,9 @@ apply.whitespace::\n \tTells 'git apply' how to handle whitespaces, in the same way\n \tas the '--whitespace' option. See linkgit:git-apply[1].\n \n+:date mode config: blame\n+include::date-mode-docs.txt[]\n+\n branch.autosetupmerge::\n \tTells 'git branch' and 'git checkout' to set up new branches\n \tso that linkgit:git-pull[1] will appropriately merge from the\n@@ -1262,7 +1265,8 @@ i18n.commitEncoding::\n \n i18n.logOutputEncoding::\n \tCharacter encoding the commit messages are converted to when\n-\trunning 'git log' and friends.\n+\trunning 'git log' and friends.  Defaults to the value of\n+\t`i18n.commitEncoding` if set, UTF-8 otherwise.\n \n imap::\n \tThe configuration variables in the 'imap' section are described\n@@ -1300,12 +1304,8 @@ interactive.singlekey::\n \tlinkgit:git-add[1].  Note that this setting is silently\n \tignored if portable keystroke input is not available.\n \n-log.date::\n-\tSet the default date-time mode for the 'log' command.\n-\tSetting a value for log.date is similar to using 'git log''s\n-\t`\\--date` option.  Possible values are `relative`, `local`,\n-\t`default`, `iso`, `rfc`, and `short`; see linkgit:git-log[1]\n-\tfor details.\n+:date mode config: log\n+include::date-mode-docs.txt[]\n \n log.decorate::\n \tPrint out the ref names of any commits that are shown by the log\n@@ -1315,10 +1315,11 @@ log.decorate::\n \tThis is the same as the log commands '--decorate' option.\n \n log.showroot::\n-\tIf true, the initial commit will be shown as a big creation event.\n-\tThis is equivalent to a diff against an empty tree.\n-\tTools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which\n-\tnormally hide the root commit will now show it. True by default.\n+\tIf `true`, the initial commit will be shown as a big creation event;\n+\tthis is equivalent to a diff against an empty tree. If `false`,\n+\t'git log' and related commands will not treat the initial commit as\n+\ta big creation event.  Any root commits in `git log -p` output would\n+\tbe shown without a diff attached.  The default is `true`.\n \n mailmap.file::\n \tThe location of an augmenting mailmap file. The default\n@@ -1391,13 +1392,14 @@ notes.displayRef::\n \texist, but a glob that does not match any refs is silently\n \tignored.\n +\n-This setting can be overridden with the `GIT_NOTES_DISPLAY_REF`\n-environment variable, which must be a colon separated list of refs or\n-globs.\n-+\n The effective value of \"core.notesRef\" (possibly overridden by\n GIT_NOTES_REF) is also implicitly added to the list of refs to be\n displayed.\n++\n+This setting can be overridden with the `GIT_NOTES_DISPLAY_REF`\n+environment variable, which must be a colon separated list of refs or\n+globs. It can also be overridden with 'git log''s `--notes` option.\n+Also, this setting can be disabled by using 'git log''s `--no-notes` option.\n \n notes.rewrite.<command>::\n \tWhen rewriting commits with <command> (currently `amend` or\ndiff --git a/Documentation/date-mode-docs.txt b/Documentation/date-mode-docs.txt\nnew file mode 100644\nindex 0000000..8f07d3f\n--- /dev/null\n+++ b/Documentation/date-mode-docs.txt\n@@ -0,0 +1,87 @@\n+ifdef::datemodeoptions[]\n+\n+:datemodeoptions!:\n+\n+--time-zone=<zone>::\n+\n+\tOnly takes effect for timestamps shown in a human-readable format (such\n+\tas when using \"--pretty\") and when the timestamp is interpreted in terms\n+\tof a time zone (for instance, this option has no effect when\n+\t`--date=raw` is specified).\n++\n+The <zone> may be one of the following:\n++\n+:date mode time zone values:\n+include::date-mode-docs.txt[]\n+\n+--date=<format>::\n+\n+\tOnly takes effect for timestamps shown in a human-readable format (such\n+\tas when using \"--pretty\").\n++\n+The <format> may be one of the following:\n++\n+:date mode format values:\n+include::date-mode-docs.txt[]\n+\n+--relative-date::\n+\n+\tSynonym for `--date=relative`.\n+\n+endif::datemodeoptions[]\n+\n+ifdef::datemodetimezonevalues[]\n+* *default* causes timestamps to be interpreted in terms of the time zone\n+            recorded in the history.\n+* *local*   causes timestamps to be interpreted in terms of the user's\n+            time zone; on POSIX systems, the time zone may be selected\n+            by setting the `TZ` environment variable appropriately\n+            (for example, on GNU systems, the timestamps could be\n+            interpreted in the `+0000` (UTC) time zone by something\n+            like the following: `TZ=:UTC git log --time-zone=local`).\n+\n+:datemodetimezonevalues!:\n+endif::datemodetimezonevalues[]\n+\n+ifdef::datemodeformatvalues[]\n+* *default*  shows timestamps in git's original human-friendly format,\n+             e.g. \"Sat Jul 20 00:00:00 1985 -0400\".\n+* *relative* shows timestamps relative to the current time,\n+             e.g. \"2 hours ago\".\n+* *iso8601* (or *iso*) shows timestamps in ISO 8601 format,\n+             kke.g. \"1985-07-20 00:00:00 -0400\".\n+* *rfc2822* (or *rfc*) shows timestamps in RFC 2822 format\n+            (which is used in email messages),\n+             e.g. \"Sat, 20 Jul 1985 00:00:00 -0400\".\n+* *short*    shows timestamps as only the date (no time) in `YYYY-MM-DD` format,\n+             e.g. \"1985-07-20\".\n+* *raw*      shows timestamps in the internal git format (as in GNU `date`'s\n+            `\"+%s %z\"` format; that is,\n+            \"<seconds since The Epoch> <time zone in +HHMM format>\"),\n+             e.g. \"490680000 -0400\".\n+\n+:datemodeformatvalues!:\n+endif::datemodeformatvalues[]\n+\n+ifdef::datemodeconfig[]\n+:command: {datemodeconfig}\n+:datemodeconfig!:\n+\n+{command}.timezone::\n+\tSet the default date mode time zone for the '{command}' command.\n+\tSetting a value for `{command}.timezone` is similar to using\n+\t'git {command}''s `\\--time-zone` option.  Possible values are:\n++\n+:date mode time zone values:\n+include::date-mode-docs.txt[]\n+\n+{command}.date::\n+\tSet the default date mode format for the '{command}' command.\n+\tSetting a value for `{command}.date` is similar to using\n+\t'git {command}''s `\\--date` option.  Possible values are:\n++\n+:date mode format values:\n+include::date-mode-docs.txt[]\n+\n+:command!:\n+endif::datemodeconfig[]\ndiff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt\nindex 152e695..a91d2bf 100644\n--- a/Documentation/git-for-each-ref.txt\n+++ b/Documentation/git-for-each-ref.txt\n@@ -114,9 +114,22 @@ the object referred by the ref does not cause an error.  It\n returns an empty string instead.\n \n As a special case for the date-type fields, you may specify a format for\n-the date by adding one of `:default`, `:relative`, `:short`, `:local`,\n-`:iso8601` or `:rfc2822` to the end of the fieldname; e.g.\n-`%(taggerdate:relative)`.\n+the date by adding one of the following to the end of the fieldname\n+(e.g. `%(taggerdate:rfc)`):\n+\n+:date mode format values:\n+include::date-mode-docs.txt[]\n+\n+Similarly, you may specify the time zone in which to interpret the\n+date by adding one of the following to the end of the fieldname\n+(e.g. `%(taggerdate&#64;local)`):\n+\n+:date mode time zone values:\n+include::date-mode-docs.txt[]\n+\n+Of course, both the format and time zone specifications may be added\n+at the same time (e.g. `%(taggerdate:rfc@local)` or, equivalently,\n+`%(taggerdate&#64;local:rfc)`).\n \n \n EXAMPLES\ndiff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\nindex de5c0d3..03e0ae3 100644\n--- a/Documentation/git-log.txt\n+++ b/Documentation/git-log.txt\n@@ -139,49 +139,6 @@ Discussion\n \n include::i18n.txt[]\n \n-Configuration\n--------------\n-\n-See linkgit:git-config[1] for core variables and linkgit:git-diff[1]\n-for settings related to diff generation.\n-\n-format.pretty::\n-\tDefault for the `--format` option.  (See \"PRETTY FORMATS\" above.)\n-\tDefaults to \"medium\".\n-\n-i18n.logOutputEncoding::\n-\tEncoding to use when displaying logs.  (See \"Discussion\", above.)\n-\tDefaults to the value of `i18n.commitEncoding` if set, UTF-8\n-\totherwise.\n-\n-log.date::\n-\tDefault format for human-readable dates.  (Compare the\n-\t`--date` option.)  Defaults to \"default\", which means to write\n-\tdates like `Sat May 8 19:35:34 2010 -0500`.\n-\n-log.showroot::\n-\tIf `false`, 'git log' and related commands will not treat the\n-\tinitial commit as a big creation event.  Any root commits in\n-\t`git log -p` output would be shown without a diff attached.\n-\tThe default is `true`.\n-\n-mailmap.file::\n-\tSee linkgit:git-shortlog[1].\n-\n-notes.displayRef::\n-\tWhich refs, in addition to the default set by `core.notesRef`\n-\tor 'GIT_NOTES_REF', to read notes from when showing commit\n-\tmessages with the 'log' family of commands.  See\n-\tlinkgit:git-notes[1].\n-+\n-May be an unabbreviated ref name or a glob and may be specified\n-multiple times.  A warning will be issued for refs that do not exist,\n-but a glob that does not match any refs is silently ignored.\n-+\n-This setting can be disabled by the `--no-notes` option,\n-overridden by the 'GIT_NOTES_DISPLAY_REF' environment variable,\n-and overridden by the `--notes=<ref>` option.\n-\n GIT\n ---\n Part of the linkgit:git[1] suite\ndiff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt\nindex 415f4f0..5909913 100644\n--- a/Documentation/git-rev-list.txt\n+++ b/Documentation/git-rev-list.txt\n@@ -44,7 +44,9 @@ SYNOPSIS\n \t     [ \\--regexp-ignore-case | -i ]\n \t     [ \\--extended-regexp | -E ]\n \t     [ \\--fixed-strings | -F ]\n-\t     [ \\--date=(local|relative|default|iso|rfc|short) ]\n+\t     [ \\--time-zone=<zone> ]\n+\t     [ \\--date=<format> ]\n+\t     [ \\--time-zone=<zone> ]\n \t     [ [\\--objects | \\--objects-edge] [ \\--unpacked ] ]\n \t     [ \\--pretty | \\--header ]\n \t     [ \\--bisect ]\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex 71fc0ae..3e3ef7f 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -104,7 +104,7 @@ COMMANDS\n \n --localtime;;\n \tStore Git commit times in the local timezone instead of UTC.  This\n-\tmakes 'git log' (even without --date=local) show the same times\n+\tmakes 'git log' (even without --time-zone=local) show the same times\n \tthat `svn log` would in the local timezone.\n +\n This doesn't interfere with interoperating with the Subversion\ndiff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt\nindex 73111bb..1494247 100644\n--- a/Documentation/rev-list-options.txt\n+++ b/Documentation/rev-list-options.txt\n@@ -634,32 +634,8 @@ endif::git-rev-list[]\n \n include::pretty-options.txt[]\n \n---relative-date::\n-\n-\tSynonym for `--date=relative`.\n-\n---date=(relative|local|default|iso|rfc|short|raw)::\n-\n-\tOnly takes effect for dates shown in human-readable format, such\n-\tas when using \"--pretty\". `log.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\".\n-+\n-`--date=local` shows timestamps in user's local timezone.\n-+\n-`--date=iso` (or `--date=iso8601`) shows timestamps in ISO 8601 format.\n-+\n-`--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822\n-format, often found in E-mail messages.\n-+\n-`--date=short` shows only date but not time, in `YYYY-MM-DD` format.\n-+\n-`--date=raw` shows the date in the internal raw git format `%s %z` format.\n-+\n-`--date=default` shows timestamps in the original timezone\n-(either committer's or author's).\n+:date mode options:\n+include::date-mode-docs.txt[]\n \n ifdef::git-rev-list[]\n --header::\n-- \n1.7.4.18.g68fe8\n"},{"id":"166122","messageId":"bbf61df6-b7fa-429e-866e-899354953cbd-mfwitten@gmail.com","threadId":"27144","inReplyTo":"0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com","subject":"[RFC 5/5] Date Mode: Tests","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T02:45:23Z","receivedAt":"2011-04-20T02:45:23Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"Date: Mon, 14 Mar 2011 20:39:44 +0000\nThis commit introduces infrastructure for testing nearly all\ncombinations of date mode input (only the format `relative'\nis currently excluded); test scripts source a date mode shell\nlibrary to set up the environment and define the general date\nmode testing driver that is then started with a test-specific\ncallback and optional parameters.\n\nCare was taken to reduce the amount of runtime overhead,\nparticularly by only updating the values of git configuration\nvariables when necessary.\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n t/date-modes-lib.sh          |  168 ++++++++++++++++++++++++++++++++++++++++++\n t/date-modes-permutator.perl |   94 +++++++++++++++++++++++\n t/t4202-log.sh               |    3 +\n t/t6300-for-each-ref.sh      |   11 +++\n t/t8002-blame.sh             |    9 ++\n 5 files changed, 285 insertions(+), 0 deletions(-)\n create mode 100755 t/date-modes-lib.sh\n create mode 100755 t/date-modes-permutator.perl\n\ndiff --git a/t/date-modes-lib.sh b/t/date-modes-lib.sh\nnew file mode 100755\nindex 0000000..5ff6192\n--- /dev/null\n+++ b/t/date-modes-lib.sh\n@@ -0,0 +1,168 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2011 Michael F Witten\n+\n+if ! test_have_prereq PERL; then\n+\tskip_all='skipping all date mode tests; perl not available'\n+\ttest_done\n+fi\n+\n+date_mode_file=d.$$\n+\n+test_expect_success 'date mode: prepare reference commit' \"\n+\ttime='2131675200 -0400'\n+\n+\texport GIT_COMMITTER_DATE=\\\"\\$time\\\"  \\\n+\t       GIT_COMMITTER_NAME=C           \\\n+\t       GIT_COMMITTER_EMAIL=C@test.git \\\n+\t       GIT_AUTHOR_DATE=\\\"\\$time\\\"     \\\n+\t       GIT_AUTHOR_NAME=A              \\\n+\t       GIT_AUTHOR_EMAIL=A@test.git\n+\n+\td=$date_mode_file\n+\n+\techo > \\$d && git add \\$d && git commit -am d\n+\"\n+\n+date_mode_perm=$TEST_DIRECTORY/date-modes-permutator.perl\n+\n+# $1 : Configuration section (the command name being configured, such as\n+#      the `log' in `log.date', etc.).\n+#\n+date_mode_unset_configs()\n+{\n+\tvar_t=$1.timezone\n+\tvar_d=$1.date\n+\n+\ttest_expect_success \"date mode: unset configs: '$var_t' and '$var_d'\" \"\n+\t\tgit config --unset-all $var_t\n+\t\tgit config --unset-all $var_d\n+\t\t! git config $var_t &&\n+\t\t! git config $var_d\n+\t\"\n+\n+\treturn 0\n+}\n+\n+# $1    : `section.variable'\n+#\n+# stdin : One line that is a value that is suitable for setting \"$1\";\n+#         an empty line commands that \"$1\" be unset.\n+#\n+date_mode_set_config()\n+{\n+\tread -r v || return 1\n+\n+\tif [ -z \"$v\" ]; then\n+\t\ttest_expect_success \\\n+\t\t\t\"date mode: unset config '$1'\" \\\n+\t\t\t\"git config --unset-all '$1';! git config '$1'\"\n+\telse\n+\t\ttest_expect_success \\\n+\t\t\t\"date mode: set config: '$1 = $v'\" \\\n+\t\t\t\"git config '$1' '$v'\"\n+\tfi\n+\n+\treturn 0\n+}\n+\n+date_mode_set_configs()\n+{\n+\tdate_mode_set_config \"$1.timezone\" &&\n+\tread -r; # skip `=' line\n+\tdate_mode_set_config \"$1.date\"\n+}\n+\n+# $1    : A value that is suitable as a date mode time zone.\n+#\n+# stdin : 2 lines:\n+#\n+#           A value that is suitable as a date mode format.\n+#\n+#           Expected output from running \"$date_mode_test_code\" (see below)\n+#\n+#         If \"$1\" or the first line is empty, then the corresponding option\n+#         is not used.\n+#\n+# Global variable `date_mode_test_code':\n+#\n+#         Shell code that can accept the arguments \"$1\" and the value of the\n+#         first line of stdin, and then output a date that is equal to the\n+#         second line of stdin.\n+#\n+date_mode_run_test()\n+{\n+\tread -r format   &&\n+\tread -r expected || return 1\n+\n+\ttest_expect_success \"date mode:${1:+ '$1'}${format:+ '$format'}\" \"\n+\t\t$date_mode_test_code '$1' '$format' > actual   &&\n+\t\techo '$expected'                    > expected &&\n+\t\ttest_cmp expected actual\n+\t\"\n+\n+\treturn 0\n+}\n+\n+date_mode_error()\n+{\n+\terror \"date mode: The test is in a confused state; aborting...\"\n+}\n+\n+# $1    : Shell code that can accept the following input (empty strings\n+#         represent no specified value):\n+#\n+#           $1 : A value suitable as a date mode time zone.\n+#           $2 : A value suitable as a date mode format.\n+#\n+#         and then output a date.\n+#\n+# $2    : Configuration section (the command name being configured, such as\n+#         the `log' in `log.date', etc.); this may be the empty string, in\n+#         which case git configuration variables are not tested.\n+#\n+# $3    : The date format that is the default; the default is `default'.\n+# $4    : The date timzezone that is the default; the default is `default'.\n+#\n+# stdin : See the \"$date_mode_perm\" script.\n+#\n+date_mode_run_tests()\n+{\n+\tdate_mode_test_code=$1\n+\n+\tif [ -z \"$2\" ]; then\n+\n+\t\t\"$PERL_PATH\" \"$date_mode_perm\" '' \"$3\" \"$4\" |\n+\t\twhile read -r line; do\n+\t\t\tdate_mode_run_test \"$line\" || date_mode_error\n+\t\tdone\n+\n+\telse\n+\t\tdate_mode_unset_configs \"$2\"\n+\n+\t\t\"$PERL_PATH\" \"$date_mode_perm\" config \"$3\" \"$4\" |\n+\t\twhile read -r line; do\n+\n+\t\t\tif   [ \"$line\" = = ]; then\n+\t\t\t\tdate_mode_set_config  \"$2.date\" && read -r line\n+\t\t\telif [ \"$line\" = - ]; then\n+\t\t\t\tdate_mode_set_configs \"$2\"      && read -r line\n+\t\t\tfi &&\n+\n+\t\t\tdate_mode_run_test \"$line\" || date_mode_error\n+\n+\t\tdone\n+\tfi\n+\n+\treturn 0\n+}\n+\n+date_mode_std_args()\n+{\n+\techo \"_date_mode_std_args '$(echo \"$1\" | sed \"s/'/'\\\\\\\\''/g\")'\";\n+}\n+\n+_date_mode_std_args()\n+{\n+\teval \"$1${2:+ --time-zone='$2'}${3:+ --date='$3'}\"\n+}\ndiff --git a/t/date-modes-permutator.perl b/t/date-modes-permutator.perl\nnew file mode 100755\nindex 0000000..729e3e7\n--- /dev/null\n+++ b/t/date-modes-permutator.perl\n@@ -0,0 +1,94 @@\n+#!/usr/bin/perl\n+#\n+# Copyright (c) 2011 Michael F Witten\n+\n+use strict;\n+use warnings;\n+\n+# The values expected to be generated by the test\n+# when the given {zone}{format} is in use;\n+my %expected = ();\n+\n+#########   ZONES    FORMATS            EXPECTED\n+$expected {default} {default} = 'Mon Jul 20 00:00:00 2037 -0400';\n+$expected {default} {  ''   } = $expected{default}{default};\n+$expected {default} {rfc2822} = 'Mon, 20 Jul 2037 00:00:00 -0400';\n+$expected {default} {  rfc  } = $expected{default}{rfc2822};\n+$expected {default} {iso8601} = '2037-07-20 00:00:00 -0400';\n+$expected {default} {  iso  } = $expected{default}{iso8601};\n+$expected {default} { short } = '2037-07-20';\n+$expected {default} {  raw  } = '2131675200 -0400';\n+$expected {default} { local } = 'Mon Jul 20 04:00:00 2037 +0000';\n+$expected {  ''   }           = $expected{default};\n+$expected { local } {default} = 'Mon Jul 20 04:00:00 2037 +0000';\n+$expected { local } {  ''   } = $expected{local}{default};\n+$expected { local } {rfc2822} = 'Mon, 20 Jul 2037 04:00:00 +0000';\n+$expected { local } {  rfc  } = $expected{local}{rfc2822};\n+$expected { local } {iso8601} = '2037-07-20 04:00:00 +0000';\n+$expected { local } {  iso  } = $expected{local}{iso8601};\n+$expected { local } { short } = '2037-07-20';\n+$expected { local } {  raw  } = '2131675200 -0400';\n+$expected { local } { local } = 'Mon Jul 20 04:00:00 2037 +0000';\n+\n+my @zones   = keys %expected;\n+my @formats = keys %{$expected{$zones[0]}}; # Assuming unvarying formats\n+\n+my ($config_zone, $config_format);\n+\n+sub print_option_sets_and_expected_outputs\n+{\n+\tforeach my $z (@zones)\n+\t{\n+\t\tforeach my $f (@formats)\n+\t\t{\n+\t\t\tprint $z, \"\\n\", $f, \"\\n\";\n+\t\t\tprint $expected { $z ||  $config_zone  }\n+\t\t\t\t\t{ $f || $config_format },\n+\t\t\t\t\t\"\\n\";\n+\t\t}\n+\t}\n+}\n+\n+sub print_config_sets_and_option_sets_and_expected_outputs\n+{\n+\tforeach (@zones)\n+\t{\n+\t\t$config_zone = $_;\n+\t\tprint \"-\\n\", $_, \"\\n\";\n+\n+\t\tforeach (@formats)\n+\t\t{\n+\t\t\t$config_format = $_;\n+\t\t\tprint \"=\\n\", $_, \"\\n\";\n+\t\t\tprint_option_sets_and_expected_outputs();\n+\t\t}\n+\t}\n+}\n+\n+#########################\n+#### Start of Output ####\n+#########################\n+\n+if (defined $ARGV[1])\n+{\n+\tforeach (@zones)\n+\t{\n+\t\tmy $e = $expected{$_};\n+\t\t$e->{''} = $e->{$ARGV[1]};\n+\t}\n+}\n+\n+if (defined $ARGV[2])\n+{\n+\tforeach (@formats) {\n+\t\t$expected{''} = $expected{$ARGV[2]};\n+\t}\n+}\n+\n+\n+if (defined $ARGV[0] && $ARGV[0] eq 'config') {\n+\tprint_config_sets_and_option_sets_and_expected_outputs();\n+} else {\n+\t$config_zone = $config_format = '';\n+\tprint_option_sets_and_expected_outputs();\n+}\ndiff --git a/t/t4202-log.sh b/t/t4202-log.sh\nindex 2fcc31a..cdfea8b 100755\n--- a/t/t4202-log.sh\n+++ b/t/t4202-log.sh\n@@ -463,4 +463,7 @@ test_expect_success 'show added path under \"--follow -M\"' '\n \t)\n '\n \n+. \"$TEST_DIRECTORY\"/date-modes-lib.sh\n+date_mode_run_tests \"$(date_mode_std_args 'git log -1 --format=%ad')\" log\n+\n test_done\ndiff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh\nindex 050ed7d..d6ac4dd 100755\n--- a/t/t6300-for-each-ref.sh\n+++ b/t/t6300-for-each-ref.sh\n@@ -359,4 +359,15 @@ test_expect_success 'an unusual tag with an incomplete line' '\n \n '\n \n+. \"$TEST_DIRECTORY\"/date-modes-lib.sh\n+date_mode_run_tests '\n+\tb()\n+\t{\n+\t\tgit for-each-ref \\\n+\t\t\t--count=1 \\\n+\t\t\t--format=\"%(authordate${2:+:$2}${1:+@$1})\" \\\n+\t\t\t\"$(git symbolic-ref HEAD)\"\n+\t}\n+\tb'\n+\n test_done\ndiff --git a/t/t8002-blame.sh b/t/t8002-blame.sh\nindex d3a51e1..f049439 100755\n--- a/t/t8002-blame.sh\n+++ b/t/t8002-blame.sh\n@@ -11,4 +11,13 @@ test_expect_success 'Blame --show-email works' '\n     check_count \"<A@test.git>\" 1 \"<B@test.git>\" 1 \"<B1@test.git>\" 1 \"<B2@test.git>\" 1 \"<author@example.com>\" 1 \"<C@test.git>\" 1 \"<D@test.git>\" 1\n '\n \n+. \"$TEST_DIRECTORY\"/date-modes-lib.sh\n+date_mode_run_tests \"$(date_mode_std_args \"\n+\tb()\n+\t{\n+\t\tgit blame -c -L1,1 \\\"\\$@\\\" '$date_mode_file' |\n+\t\t\tawk -F'\\t' '{print \\$3}'\n+\t}\n+\tb\")\" blame iso8601\n+\n test_done\n-- \n1.7.4.18.g68fe8\n"},{"id":"166117","messageId":"0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com","threadId":"27144","inReplyTo":null,"subject":"[RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T02:53:36Z","receivedAt":"2011-04-20T02:53:36Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"One of the possible values for a date format is `local', which\nspecifies that a date should be output as though the date format\nwere instead `default' but in terms of the user's time zone\ninstead of the time zone stored by git; clearly, then, `local'\ndoes not really provide just another format, but rather the\ncombination of 2 specifications:\n\n  * A format for the date (`default')\n  * A time zone in which to interpret the date (`local', if you will)\n\nInterestingly, the existing documentation suggests that the original\npurpose of the `--date' option was to specify the time zone rather\nthan a format:\n\n  $ git grep -hC1 '`--date=local`\\|`--date=default`' \\\n  >   6ceb270ce6f65cf4bc2a22830f96e0cc838b3fec       \\\n  >   -- Documentation/rev-list-options.txt\n  +\n  `--date=local` shows timestamps in user's local timezone.\n  +\n  --\n  +\n  `--date=default` shows timestamps in the original timezone\n  (either committer's or author's).\n\nThis patch series reimplements the original purpose of `--date' by allowing\nthe time zone mode to be specified independently of the date format\n(see the commit message for [2] and the documentation provided by [3]):\n\n  [0] Light refactoring of date infrastructure\n  [1] Pretty Print: show tz when using DATE_LOCAL\n  [2] Date Mode: Implementation\n  [3] Date Mode: Documentation\n  [4] Date Mode: Tests\n\nThe date format `local' has thus been deprecated, though it is still\nsupported (with a warning on stderr).\n\nThese patches apply cleanly to the current tip of Junio's `next' branch:\n\n  commit 63e4ee5f87eede11d1377370c385c26c5b90c6e7\n  Merge: 359ea0b 6ceb270\n  Author: Junio C Hamano <gitster@pobox.com>\n  Date:   Tue Apr 19 11:51:25 2011 -0700\n  \n      Merge branch 'master' into next\n      \n      * master:\n        Git 1.7.5-rc3\n        Git 1.7.4.5\n        git-svn.txt: Document --mergeinfo\n  \nand it would appear that `make test' runs successfully (including the\nextensive testing that I have implemented for date mode features, both\nold and new).\n\nThere are some whitespace warnings (a la `git diff --check'), but I\nhave reviewed them and personally approve of them; if you think that\nappraisal is incorrect, then you don't know what you're talking about :-P\n\nSincerely,\nMichael Witten\n\n  Documentation/blame-options.txt    |    9 +--\n  Documentation/config.txt           |   32 ++++---\n  Documentation/date-mode-docs.txt   |   87 +++++++++++++++++++\n  Documentation/git-for-each-ref.txt |   19 ++++-\n  Documentation/git-log.txt          |   43 ---------\n  Documentation/git-rev-list.txt     |    4 +-\n  Documentation/git-svn.txt          |    2 +-\n  Documentation/rev-list-options.txt |   28 +------\n  archive.c                          |    2 +-\n  builtin/blame.c                    |   24 +++---\n  builtin/cat-file.c                 |    3 +-\n  builtin/commit.c                   |    2 +-\n  builtin/for-each-ref.c             |   65 ++++++++++----\n  builtin/log.c                      |   17 ++--\n  builtin/shortlog.c                 |    2 +-\n  builtin/show-branch.c              |    3 +-\n  cache.h                            |   41 ++++++++-\n  commit.h                           |    4 +-\n  date.c                             |   84 ++++++++++++++++---\n  fast-import.c                      |    4 +-\n  http-backend.c                     |    3 +-\n  log-tree.c                         |   10 ++-\n  pretty.c                           |   18 +++--\n  reflog-walk.c                      |    6 +-\n  reflog-walk.h                      |    4 +-\n  refs.c                             |    6 +-\n  revision.c                         |   11 ++-\n  revision.h                         |    4 +-\n  sha1_name.c                        |    5 +-\n  submodule.c                        |    2 +-\n  t/date-modes-lib.sh                |  168 ++++++++++++++++++++++++++++++++++++\n  t/date-modes-permutator.perl       |   94 ++++++++++++++++++++\n  t/t4202-log.sh                     |    3 +\n  t/t6300-for-each-ref.sh            |   15 +++-\n  t/t8002-blame.sh                   |    9 ++\n  test-date.c                        |   11 ++-\n  36 files changed, 654 insertions(+), 190 deletions(-)\n  create mode 100644 Documentation/date-mode-docs.txt\n  create mode 100755 t/date-modes-lib.sh\n  create mode 100755 t/date-modes-permutator.perl\n\n-- \n1.7.4.18.g68fe8\n"},{"id":"166130","messageId":"20110420064318.GF28597@sigill.intra.peff.net","threadId":"27144","inReplyTo":"0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-04-20T06:43:18Z","receivedAt":"2011-04-20T06:43:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 20, 2011 at 02:53:36AM +0000, Michael Witten wrote:\n\n> One of the possible values for a date format is `local', which\n> specifies that a date should be output as though the date format\n> were instead `default' but in terms of the user's time zone\n> instead of the time zone stored by git; clearly, then, `local'\n> does not really provide just another format, but rather the\n> combination of 2 specifications:\n> \n>   * A format for the date (`default')\n>   * A time zone in which to interpret the date (`local', if you will)\n>\n> [...]\n>\n> This patch series reimplements the original purpose of `--date' by allowing\n> the time zone mode to be specified independently of the date format\n> (see the commit message for [2] and the documentation provided by [3]):\n\nI think the intent of this series is good. See also this thread from\nquite a while back:\n\n  http://article.gmane.org/gmane.comp.version-control.git/112026\n\n> The date format `local' has thus been deprecated, though it is still\n> supported (with a warning on stderr).\n\nI don't know if we need to go that far. We can leave it forever as a\nhistorical compatibility feature. Its existence is not really hurting\nanyone as long as the documentation marks it as deprecated (or doesn't\neven mention it).\n\n> These patches apply cleanly to the current tip of Junio's `next' branch:\n\nWhy not \"master\"? Usually we try to develop features independently on\ntop of master, and then merge them. That way topics can graduate\nindependently to master, and it is easier to see which topics are\nresponsible for breakages. If you really need something in another topic\n(because you are directly building on it, or the merge would just be too\npainful), then build straight on that topic's commits, not on top of\nnext (and of course tell everyone which topic it's built on).\n\n> There are some whitespace warnings (a la `git diff --check'), but I\n> have reviewed them and personally approve of them; if you think that\n> appraisal is incorrect, then you don't know what you're talking about :-P\n\nAll of the warnings I saw are related to indentation with spaces, and it\nlooks like your intent in each case is to line up the opening paren of a\nfunction call with a line of arguments below, like:\n\n   foo(bar, baz\n       bleep, moof);\n\nThat's fine, style-wise, but the run of spaces should be collapsed into\ntabs followed by spaces, with each tab representing 8 spaces (some would\nargue that it should be \"one tab for each level of structural\nindentation, plus spaces to line up the arguments\", but I don't find\nthat we tend to follow such a rule in git).\n\n-Peff\n"},{"id":"166149","messageId":"4a235331-951f-481e-8603-896af4e67df9-mfwitten@gmail.com","threadId":"27144","inReplyTo":"20110420064318.GF28597@sigill.intra.peff.net","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T14:21:11Z","receivedAt":"2011-04-20T14:21:11Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Wed, 20 Apr 2011 02:43:18 -0400, Jeff King wrote:\n\n> On Wed, Apr 20, 2011 at 02:53:36AM +0000, Michael Witten wrote:\n>\n>> One of the possible values for a date format is `local', which\n>> specifies that a date should be output as though the date format\n>> were instead `default' but in terms of the user's time zone\n>> instead of the time zone stored by git; clearly, then, `local'\n>> does not really provide just another format, but rather the\n>> combination of 2 specifications:\n>> \n>>   * A format for the date (`default')\n>>   * A time zone in which to interpret the date (`local', if you will)\n>>\n>> [...]\n>>\n>> This patch series reimplements the original purpose of `--date' by allowing\n>> the time zone mode to be specified independently of the date format\n>> (see the commit message for [2] and the documentation provided by [3]):\n>\n> I think the intent of this series is good. See also this thread from\n> quite a while back:\n>\n>  http://article.gmane.org/gmane.comp.version-control.git/112026\n\nI took a cursory look, but I've spent so much time on this series already\nthat I don't really care what it says; if there are particular concerns\nthat you think I might not have met, then let me know in this discussion :-)\n\nIn any case, my approach is not only infintely cleaner than some of the\nstuff I saw in that thread, but it's also complete and working (and it is\nextensive without being invasive).\n"},{"id":"166150","messageId":"0e899fff-5833-4686-aa81-4bd77f2bd633-mfwitten@gmail.com","threadId":"27144","inReplyTo":"20110420064318.GF28597@sigill.intra.peff.net","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T14:22:45Z","receivedAt":"2011-04-20T14:22:45Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Wed, 20 Apr 2011 02:43:18 -0400, Jeff King wrote:\n\n> On Wed, Apr 20, 2011 at 02:53:36AM +0000, Michael Witten wrote:\n>\n>> The date format `local' has thus been deprecated, though it is still\n>> supported (with a warning on stderr).\n>\n> I don't know if we need to go that far. We can leave it forever as a\n> historical compatibility feature. Its existence is not really hurting\n> anyone as long as the documentation marks it as deprecated (or doesn't\n> even mention it).\n\nThe references to a `local' *format* have indeed been removed from\nthe documentation, and the warning is just an indication that the\ncode that supports it will also be removed at some point too.\n\nHowever, the warning mechanism (in general) could be improved by\nproducing the message only when exiting the program (after the\npager has been destroyed); currently, the message can be quite\neasy to miss otherwise (depending on the way the terminal handles\nthe buffer history).\n\nI don't see the point of leaving crufty code in place forever; it's\nridiculous that my modern CPU starts up like a 35 year old chip\nwhen the very few people who need that functionality (if anybody)\ncan emulate it if necessary.\n\nAs an aside, I've always found it amusing that most programmers\nare adamant about justifying an existing use case for a new\nfeature before even considering an implementation for it, but yet\nthey will gladly keep around dead code until the next Big Bang.\n"},{"id":"166151","messageId":"7963bbbe-9b85-492c-ad10-24a80e4eb1b8-mfwitten@gmail.com","threadId":"27144","inReplyTo":"20110420064318.GF28597@sigill.intra.peff.net","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T14:22:57Z","receivedAt":"2011-04-20T14:22:57Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Wed, 20 Apr 2011 02:43:18 -0400, Jeff King wrote:\n\n> On Wed, Apr 20, 2011 at 02:53:36AM +0000, Michael Witten wrote:\n>\n>> These patches apply cleanly to the current tip of Junio's `next' branch:\n>\n> Why not \"master\"? Usually we try to develop features independently on\n> top of master, and then merge them. That way topics can graduate\n> independently to master, and it is easier to see which topics are\n> responsible for breakages. If you really need something in another topic\n> (because you are directly building on it, or the merge would just be too\n> painful), then build straight on that topic's commits, not on top of\n> next (and of course tell everyone which topic it's built on).\n\nInteresting points.\n\nI was building on `master', but I figured I would expedite the testing\nof my patch by making sure that it applies to the recent tip of `next'\nwithout trouble.\n\nIn fact, when I did rebase onto `next', there were a couple of minor\nconflicts that I had to resolve, so I can safely say that the current\npatch series depends upon the following 2 topics:\n\n  commit 84393bfd731c435120dc1dda63432a70124821cb\n  Author: Namhyung Kim <namhyung@gmail.com>\n  Date:   Wed Apr 6 11:20:50 2011 +0900\n\n      blame: add --abbrev command line option and make it honor core.abbrev\n      \n      If user sets config.abbrev option, use it as if --abbrev was given.  This\n      is the default value and user can override different abbrev length by\n      specifying the --abbrev=N command line option.\n      \n      Signed-off-by: Namhyung Kim <namhyung@gmail.com>\n      Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\n  commit ef803fd4b09bca707c7c27669a2789bb050b488c\n  Author: Michael J Gruber <git@drmicha.warpmail.net>\n  Date:   Fri Apr 1 11:20:31 2011 +0200\n\n      builtin/log.c: separate default and setup of cmd_log_init()\n      \n      cmd_log_init() sets up some default rev options and then calls\n      setup_revisions(), so that a caller cannot set up own defaults: Either\n      they get overriden by cmd_log_init() (if set before) or they override\n      the command line (if set after). We even complain about this in a\n      comment to cmd_log_reflog().\n      \n      Therefore, separate the two steps so that one can still call\n      cmd_log_init() or, alternatively, cmd_log_init_defaults() followed by\n      cmd_log_init_finish() (and set defaults in between).\n      \n      No functional change so far.\n      \n      Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n      Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nThose look likely to go into master, so it actually seems like a good idea to\nhave gone ahead and taken care of the conflict. However, in the future, I will\nsend patches to `master' only.\n"},{"id":"166152","messageId":"d74e95d4-ef16-42fb-ae8f-b1d7a8b9d91e-mfwitten@gmail.com","threadId":"27144","inReplyTo":"20110420064318.GF28597@sigill.intra.peff.net","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-20T14:23:37Z","receivedAt":"2011-04-20T14:23:37Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Wed, 20 Apr 2011 02:43:18 -0400, Jeff King wrote:\n\n>> There are some whitespace warnings (a la `git diff --check'), but I\n>> have reviewed them and personally approve of them; if you think that\n>> appraisal is incorrect, then you don't know what you're talking about :-P\n>\n> All of the warnings I saw are related to indentation with spaces, and it\n> looks like your intent in each case is to line up the opening paren of a\n> function call with a line of arguments below, like:\n>\n>   foo(bar, baz\n>       bleep, moof);\n>\n> That's fine, style-wise, but the run of spaces should be collapsed into\n> tabs followed by spaces, with each tab representing 8 spaces.\n\nI understand this, as I've read:\n\n  Documentation/CodingGuidelines\n\nand I'm also responsible for this massive git flamewar of yore on the same\nsubject:\n\n  http://article.gmane.org/gmane.comp.version-control.git/61095\n  Message-ID: 634393B0-734A-4884-93E3-42F7D3CB157F@mit.edu\n\nHowever - and this is the key point - if you are going to be mixing\ntabs and spaces ANYWAY, then you might as well do it in a way that\nmaintains alignment within a tab level regardless of the current\nsetting for the tabwidth:\n\n> (some would argue that it should be \"one tab for each level of\n> structural indentation, plus spaces to line up the arguments\",\n> but I don't find that we tend to follow such a rule in git).\n\nThat approach is the most logical and the most robust, and if\nsomebody messes it up, then the whitespace simply reduces\n(or degenerates) back to just the very approach you espouse\nanyway.\n"},{"id":"166169","messageId":"20110421000701.GA10987@elie","threadId":"27144","inReplyTo":"d74e95d4-ef16-42fb-ae8f-b1d7a8b9d91e-mfwitten@gmail.com","subject":"Tabs and spaces (Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-21T00:07:01Z","receivedAt":"2011-04-21T00:07:01Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Michael,\n\nMichael Witten wrote:\n\n> and I'm also responsible for this massive git flamewar of yore on the same\n> subject:\n> \n>   http://article.gmane.org/gmane.comp.version-control.git/61095\n>   Message-ID: 634393B0-734A-4884-93E3-42F7D3CB157F@mit.edu\n\nHeh. :)\n\n> However - and this is the key point - if you are going to be mixing\n> tabs and spaces ANYWAY, then you might as well do it in a way that\n> maintains alignment within a tab level regardless of the current\n> setting for the tabwidth:\n\nIn principle, I generally agree.  But as mentioned in the thread you\nreference, most text editors don't make that very easy.\n\nI personally use a tabwidth of 6 when I really want to concentrate on\nreading.  When coding in a rush for other people, that leads to using\ntabstop of 8 and only aligning text that is much shorter than one tab:\n\n\tif (foo && bar && baz &&\n\t    qux && quux) {\n\t\t...\n\t} else if (quuux(quuuux, quuuuux,\n\t\t\t\tlong_expresion_comes_here(quuuuuux))) {\n\t\t...\n\t}\n\nAs you can see, this is following the \"put continuation lines near the\nright margin\" convention advocated in linux-2.6's\nDocumentation/CodingStyle.\n\nTwo advantages:\n\n - looks sensible with any tabstop\n - no need to cascade changes on following lines when the width of a\n   function name changes\n\nOne major disadvantage:\n\n - annoys people who like everything nicely lined up.\n\nFor what it's worth.  (Not much, of course --- the best rule is as\nalways to make sure your code fits well with the code around it.)\n\nHope that helps,\nJonathan\n"},{"id":"166172","messageId":"7v62q8z824.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"4a235331-951f-481e-8603-896af4e67df9-mfwitten@gmail.com","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-21T01:50:43Z","receivedAt":"2011-04-21T01:50:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n>> I think the intent of this series is good. See also this thread from\n>> quite a while back:\n>>\n>>  http://article.gmane.org/gmane.comp.version-control.git/112026\n>\n> I took a cursory look, but I've spent so much time on this series already\n> that I don't really care what it says...\n\nThis is not a very good way to motivate somebody who is already tired at\nthe end of the day to reivew the RFC series, I would have to say.\n"},{"id":"166173","messageId":"1235e29d-6cbb-445b-9b6f-4e174c03ba8f-mfwitten@gmail.com","threadId":"27144","inReplyTo":"20110421000701.GA10987@elie","subject":"Re: Tabs and spaces","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-21T01:51:01Z","receivedAt":"2011-04-21T01:51:01Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Wed, 20 Apr 2011 19:07:01 -0500, Jonathan Nieder wrote:\n\n>> However - and this is the key point - if you are going to be mixing\n>> tabs and spaces ANYWAY, then you might as well do it in a way that\n>> maintains alignment within a tab level regardless of the current\n>> setting for the tabwidth:\n>\n> In principle, I generally agree.  But as mentioned in the thread you\n> reference, most text editors don't make that very easy.\n\nYou just need an editor that can insert into a newly created line the\nsame leading whitespace characters that were on the previous line (of\ncourse, it's nice if lines with only whitespace are automatically\nconverted to empty lines); if your text editor can't do that, then any\nstyle of indentation/alignment is going to be painful.\n\n> I personally use a tabwidth of 6 when I really want to concentrate on\n> reading.  When coding in a rush for other people, that leads to using\n> tabstop of 8 and only aligning text that is much shorter than one tab:\n>\n> \tif (foo && bar && baz &&\n> \t    qux && quux) {\n> \t\t...\n> \t} else if (quuux(quuuux, quuuuux,\n> \t\t\t\tlong_expresion_comes_here(quuuuuux))) {\n> \t\t...\n> \t}\n>\n> As you can see, this is following the \"put continuation lines near the\n> right margin\" convention advocated in linux-2.6's\n> Documentation/CodingStyle.\n\nIt's not hard to see why \"near the right margin\" is an important remark;\nwith a tabstop of 8, your code is rendered like this:\n\n        if (foo && bar && baz &&\n            qux && quux) {\n                ...\n        } else if (quuux(quuuux, quuuuux,\n                                long_expresion_comes_here(quuuuuux))) {\n                ...\n        }\n\nHowever, with a tabstop of 2, it looks like this:\n\n  if (foo && bar && baz &&\n      qux && quux) {\n    ...\n  } else if (quuux(quuuux, quuuuux,\n        long_expresion_comes_here(quuuuuux))) {\n    ...\n  }\n\nNotice that your `qux && quux' line (which follows the method we both like)\nremained nicely aligned, but your `long_expression_comes_here' line has\nmoved back so much that it doesn't even satisfy the `right margin' rule\nanymore.\n\n> Two advantages:\n>\n>  - looks sensible with any tabstop\n\nAs we have seen, the sensibility of using tabs for *alignment* is precarious;\non the contrary, using spaces for alignment [across lines of the same level of\ntabular indentation] remains *exactly* as sensible as intended by the original\nauthor, regardless of the tabstop setting.\n\nThe problem is that there are really two issues that are being conflated\"\n\n\t* Indentation : This can be implemented with tabs\n\t* Alignment   : This should be implemented with only spaces\n\n> - no need to cascade changes on following lines when the width of a\n>   function name changes\n\nThat is indeed the best reason to avoid alignment (after all, by its\nvery nature, alignment implies a coupling between lines), and I find\nmyself in constant intellectual conflict over that very issue. However,\nif the number of lines to be aligned is rather small or alignment\nobviously helps readability, then it's a rather minor risk.\n\nNow, your example of a changing function name is a good one; for instance,\nconsider one of the functions that my patch series introduces:\n\n\tint parse_date_mode_config_internal(const char *var_date,\n\t                                     const char *var_time_zone,\n\t                                     const char *var,\n\t                                     const char *value,\n\t                                     struct date_mode *d,\n\t                                     int *ret);\n\nI just noticed that the parameters are misaligned by one space; it should\nbe the following:\n\n\tint parse_date_mode_config_internal(const char *var_date,\n\t                                    const char *var_time_zone,\n\t                                    const char *var,\n\t                                    const char *value,\n\t                                    struct date_mode *d,\n\t                                    int *ret);\n\nI probably changed the function name by 1 character at some point and then\nforgot to update the alignment of the parameters. :-(\n\nNow, I actually hate that style of continuation, and I only used it because\nthat's basically what everybody else on the planet (and in the git project)\ntries to do (albeit with some apalling combination of tabs and spaces).\n\nIn such a case, I would much rather treat parameters as `subelements' of\nthe function construct (prototype, call, etc.) by explicitly giving them\ntheir own indentation level; this transforms the problem from one of\nindentation and alignment to a problem of just indentation, thereby allowing\nfor nothing but tabs:\n\n\tint parse_date_mode_config_internal\n\t(\n\t\tconst char *var_date,\n\t\tconst char *var_time_zone,\n\t\tconst char *var,\n\t\tconst char *value,\n\t\tstruct date_mode *d,\n\t\tint *ret\n\t);\n\nA function call might look like this:\n\n\tparse_date_mode_config_internal\n\t(\n\t\t\"Some value of some sort\",\n\t\t\"Another value of some sort\",\n\t\t\"dingleberry\",\n\t\td,\n\t\tret\n\t);\n\nOf course, this opens up the debate about where the opening parenthesis should\ngo; if the `{' of a block is routinely put on the same line as, say, an `if',\nthen perhaps this would look more natural:\n\n\tparse_date_mode_config_internal (\n\t\t\"Some value of some sort\",\n\t\t\"Another value of some sort\",\n\t\t\"dingleberry\",\n\t\tdate_mode,\n\t\treturn_value\n\t);\n\nAn `if' statement is kind of gross to mold in this way due to the fact that\nthere are two parts, each with its own subelements; at some point, you might\nas well just make some temporary variables with reasonably short names in\norder to hold the condition value, thereby obviating this nightmare in the\nfirst place.\n\nHowever, if you must write every expression explicitly in place, then your\nexample could be written thusly:\n\n\tif (\n \t\tfoo && bar &&\n \t\tbaz && qux &&\n\t\tquux\n\t){\n \t\t...\n\t} else if (\n\t\tquuux (\n\t\t\tquuuux,\n\t\t\tquuuuux,\n\t\t\tlong_expresion_comes_here (\n\t\t\t\tquuuuuux\n\t\t\t)\n\t\t)\n\t){\n\t\t...\n\t}\n\nor more drawn out:\n\n\tif\n\t(\n \t\tfoo &&\n \t\tbar &&\n \t\tbaz &&\n\t\tqux &&\n\t\tquux\n\t)\n\t{\n \t\t...\n\t}\n\telse if\n\t(\n\t\tquuux\n\t\t(\n\t\t\tquuuux,\n\t\t\tquuuuux,\n\t\t\tlong_expresion_comes_here\n\t\t\t(\n\t\t\t\tquuuuuux\n\t\t\t)\n\t\t)\n\t)\n\t{\n\t\t...\n\t}\n\nAgain, it should be recognized that there are 2 issues:\n\n\t* Indentation : This can be implemented with tabs\n\t* Alignment   : This should be implemented with only spaces\n\nand it should also be recognized that treating tabs as a primitive\nmeans of space-saving compression by having it always represent\nsome constant number of spaces (8) is just as flaky as expecting\npeople to properly use spaces for alignment; thus you might as\nwell go for the latter in order to get the best of both worlds,\nbecause somebody is going to mess it up either way.\n\nSincerely,\n\tMichael\n\t\tWitten\n"},{"id":"166174","messageId":"BANLkTikbgfjq2J3K4_21zVQSTgnteZfMqg@mail.gmail.com","threadId":"27144","inReplyTo":"7v62q8z824.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-21T02:14:20Z","receivedAt":"2011-04-21T02:14:20Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, Apr 21, 2011 at 01:50, Junio C Hamano <gitster@pobox.com> wrote:\n> Michael Witten <mfwitten@gmail.com> writes:\n>\n>>> I think the intent of this series is good. See also this thread from\n>>> quite a while back:\n>>>\n>>>  http://article.gmane.org/gmane.comp.version-control.git/112026\n>>\n>> I took a cursory look, but I've spent so much time on this series already\n>> that I don't really care what it says...\n>\n> This is not a very good way to motivate somebody who is already tired at\n> the end of the day to reivew the RFC series, I would have to say.\n\nThen you can save us both time and just apply my series immediately :-P\n\nYou're taking it wholly out of context; the full sentence is indeed:\n\"I took a cursory look, but I've spent so much time on this series\nalready that I don't really care what it says; if there are particular\nconcerns that you think I might not have met, then let me know in this\ndiscussion :-)\"\n\nTwo points, though:\n\n  * Mentioning another thread is not in any\n    way a review of this current patch series.\n\n  * I'm passed the phase of worrying about which\n    cases I might have missed; that's why I\n    have submitted my work to the list in order\n    to give less-weary eyes a chance to think\n    about it.\n"},{"id":"166175","messageId":"20110421021825.GA23373@elie","threadId":"27144","inReplyTo":"1235e29d-6cbb-445b-9b6f-4e174c03ba8f-mfwitten@gmail.com","subject":"Re: Tabs and spaces","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-21T02:18:25Z","receivedAt":"2011-04-21T02:18:25Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Michael Witten wrote:\n\n> You just need an editor that [...]\n\nwhich many contributors don't have (or haven't configured that way).\nReally.\n\n[...]\n> However, with a tabstop of 2, it looks like this:\n>\n>   if (foo && bar && baz &&\n>       qux && quux) {\n>     ...\n>   } else if (quuux(quuuux, quuuuux,\n>         long_expresion_comes_here(quuuuuux))) {\n>     ...\n>   }\n>\n> Notice that your `qux && quux' line (which follows the method we both like)\n> remained nicely aligned, but your `long_expression_comes_here' line has\n> moved back so much that it doesn't even satisfy the `right margin' rule\n> anymore.\n\nOh, I still think a tabstop of 2 is insane (for various reasons, some\nexplained in the thread you mentioned).\n\nNo matter --- Junio will use --whitespace=fixup to convert your spaces\nto tabs anyway.  Just thought I could give some survival tips.\n\nRegards,\nJonathan\n"},{"id":"166176","messageId":"BANLkTi=XqynMpRkR=cRMTXYjr+p=Jxt=Ng@mail.gmail.com","threadId":"27144","inReplyTo":"20110421021825.GA23373@elie","subject":"Re: Tabs and spaces","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-21T03:15:09Z","receivedAt":"2011-04-21T03:15:09Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, Apr 21, 2011 at 02:18, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Michael Witten wrote:\n>\n>> You just need an editor that [...]\n>\n> which many contributors don't have (or haven't configured that way).\n> Really.\n\nto which I already said: \"if your text editor can't do that, then any\nstyle of indentation/alignment is going to be painful.\"\n\n>\n> [...]\n>> However, with a tabstop of 2, it looks like this:\n>>\n>>   if (foo && bar && baz &&\n>>       qux && quux) {\n>>     ...\n>>   } else if (quuux(quuuux, quuuuux,\n>>         long_expresion_comes_here(quuuuuux))) {\n>>     ...\n>>   }\n>>\n>> Notice that your `qux && quux' line (which follows the method we both like)\n>> remained nicely aligned, but your `long_expression_comes_here' line has\n>> moved back so much that it doesn't even satisfy the `right margin' rule\n>> anymore.\n>\n> Oh, I still think a tabstop of 2 is insane (for various reasons, some\n> explained in the thread you mentioned).\n\nThat's not really the point, though, is it.\n\n> No matter --- Junio will use --whitespace=fixup to convert your spaces\n> to tabs anway.\n\nGood!\n\nThat means I can be satisfied with having written sane patches, and\nJunio can be satisfied with having forced the insane use of tabs. It's\na win-win :-D\n"},{"id":"166177","messageId":"BANLkTin4kD96Fw_hpJCGW1K8Khfc=A=n_Q@mail.gmail.com","threadId":"27144","inReplyTo":"BANLkTi=XqynMpRkR=cRMTXYjr+p=Jxt=Ng@mail.gmail.com","subject":"Re: Tabs and spaces","fromName":"Thiago Farina","fromEmail":"tfransosi@gmail.com","sentAt":"2011-04-21T03:25:32Z","receivedAt":"2011-04-21T03:25:32Z","isPatch":false,"sender":{"key":"tfransosi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/970071?v=4"},"body":"On Thu, Apr 21, 2011 at 12:15 AM, Michael Witten <mfwitten@gmail.com> wrote:\n>> Oh, I still think a tabstop of 2 is insane (for various reasons, some\n>> explained in the thread you mentioned).\n>\ntabstop of 2 is what we use on Chromium code (with spaces, no tabs).\nAnd works very well. Just my 0.02 cents. ;)\n"},{"id":"166179","messageId":"7v1v0wz26y.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"BANLkTikbgfjq2J3K4_21zVQSTgnteZfMqg@mail.gmail.com","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-21T03:57:25Z","receivedAt":"2011-04-21T03:57:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n>>> I took a cursory look, but I've spent so much time on this series already\n>>> that I don't really care what it says...\n>>\n>> This is not a very good way to motivate somebody who is already tired at\n>> the end of the day to reivew the RFC series, I would have to say.\n>\n> Then you can save us both time and just apply my series immediately :-P\n\nThat's not how things work around here.\n\nThe default is not to apply, unless the goal of the change is worthy and\nthe patch implements that change well.  It is submitter's job to convince\npeople that the change is worthy, justify that it is worth reviewers' time\nto review the patch, and respond to questions and suggestions for\nimprovements.\n\nBy doing these responsibly, you win support for the particular patchset,\nand win trust from others in you, which would affect further patches from\nyou.\n\nIt is not exactly a good way to win support to dump a patchset, to declare\nthat you are beyond the point of rethinking, to say a take-it-or-leave-it,\nnor to defend your private style that goes against the project's coding\nstyle (style is subjective and there is no right or wrong).\n\nI know you know all of the above from your \":-P\" (and your past patch\nsubmissions), but I am writing these down so that people new to the list\ndo not get a wrong impression from this exchange.\n"},{"id":"166180","messageId":"BANLkTikai1zYNrzka8DyGkCUpbJUskfQbQ@mail.gmail.com","threadId":"27144","inReplyTo":"7v1v0wz26y.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-21T04:09:52Z","receivedAt":"2011-04-21T04:09:52Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, Apr 21, 2011 at 03:57, Junio C Hamano <gitster@pobox.com> wrote:\n\n> It is not exactly a good way to win support to dump a patchset, to declare\n> that you are beyond the point of rethinking, to say a take-it-or-leave-it,\n> nor to defend your private style that goes against the project's coding\n> style (style is subjective and there is no right or wrong).\n\nWell, I wanted to respond here with:\n\n    \"But I did nothing of the sort!\"\n\nHowever, you stole my thunder:\n\n> I know you know all of the above from your \":-P\" (and your past patch\n> submissions), but I am writing these down so that people new to the list\n> do not get a wrong impression from this exchange.\n\nFirstly, I'm not sure that this exchange has been that bad; perhaps\none of us perceives too little or too much when there is just email\ntext.\n\nSecondly, don't you think that particular worry is a bit paranoid?\n"},{"id":"166186","messageId":"BANLkTimgVCh19saLiJJfFnoWKny8-MiHrA@mail.gmail.com","threadId":"27144","inReplyTo":"BANLkTin4kD96Fw_hpJCGW1K8Khfc=A=n_Q@mail.gmail.com","subject":"Re: Tabs and spaces","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2011-04-21T10:46:04Z","receivedAt":"2011-04-21T10:46:04Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Thu, Apr 21, 2011 at 05:25, Thiago Farina <tfransosi@gmail.com> wrote:\n> On Thu, Apr 21, 2011 at 12:15 AM, Michael Witten <mfwitten@gmail.com> wrote:\n>>> Oh, I still think a tabstop of 2 is insane (for various reasons, some\n>>> explained in the thread you mentioned).\n>>\n> tabstop of 2 is what we use on Chromium code (with spaces, no tabs).\n\nIt's indentation. You indent your code by 2 space.\nIt has nothing to do with tabstop.\n"},{"id":"166191","messageId":"3d145d51-e76d-44c7-b9b2-7b48c14b6043-mfwitten@gmail.com","threadId":"27144","inReplyTo":"BANLkTimgVCh19saLiJJfFnoWKny8-MiHrA@mail.gmail.com","subject":"Re: Tabs and spaces","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-21T12:57:38Z","receivedAt":"2011-04-21T12:57:38Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, Apr 21, 2011 at 10:46, Alex Riesen <raa.lkml@gmail.com> wrote:\n\n> On Thu, Apr 21, 2011 at 05:25, Thiago Farina <tfransosi@gmail.com> wrote:\n>> On Thu, Apr 21, 2011 at 12:15 AM, Michael Witten <mfwitten@gmail.com> wrote:\n>>>> Oh, I still think a tabstop of 2 is insane (for various reasons, some\n>>>> explained in the thread you mentioned).\n>>>\n>> tabstop of 2 is what we use on Chromium code (with spaces, no tabs).\n>\n> It's indentation. You indent your code by 2 space.\n> It has nothing to do with tabstop.\n\nIn this discussion, it has everything to do with the tabstops\n(1235e29d-6cbb-445b-9b6f-4e174c03ba8f-mfwitten@gmail.com):\n\n> Again, it should be recognized that there are 2 issues:\n>\n>        * Indentation : This *can* be implemented with tabs\n>        * Alignment   : This *should* be implemented with only spaces\n>\n> and it should also be recognized that treating tabs as a primitive\n> means of space-saving compression by having it always represent\n> some constant number of spaces (8) is just as flaky as expecting\n> people to properly use spaces for alignment; thus you might as\n> well go for the latter in order to get the best of both worlds,\n> because somebody is going to mess it up either way.\n"},{"id":"166210","messageId":"7vtydrutbq.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"acbcf231-e0a6-440e-be42-5f25da3e318d-mfwitten@gmail.com","subject":"Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-21T22:34:49Z","receivedAt":"2011-04-21T22:34:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n> Date: Fri, 11 Feb 2011 16:06:36 +0000\n> Currently, when the date mode is DATE_LOCAL, the\n> time zone is never pretty printed;...\n\nI am not opposed to have a new mode that shows timestamps in local\ntimezone with zone information, but this change is a regression to people\nwho have known and relied upon that asking for timestamps in their local\ntimezone will give everything in the local timezone and result in a short\noutput by the virtue of not needing to repeat the zone string, as they are\nthe same (this is not strictly true near your dst boundary, and that is\nwhy I am open to the idea as a separate option).\n\nThis is a tangent but it is funny to see the unnecessary Date: in-body\nheader for a series about date display.  Please drop it.\n\nBackdating the author timestamp will make it harder to find the related\ndiscussion from the list archive; the only plausible benefit I can see is\nthat you may get \"I thought of this much earlier than when I posted it to\nthe public for the first time\" pee-in-the-snow value out of doing so, but\nthat is done at the cost to all others who need to inspect the history\nlater.  Please don't.\n\nAs a future reference, when you have a valid reason to override the\nheader information your MUA would give your message with an in-body\nheader, please leave a blank line after the in-body header to make the\nresult easier to read, like this:\n\n        Date: Fri, 11 Feb 2011 16:06:36 +0000\n\n        Currently, when the date mode is DATE_LOCAL, the\n        time zone is never pretty printed;...\n\nAlso paragraphs that wrap lines at too narrow a margin is just as hard to\nread as paragraphs wrapped at a margin that is too wide.  You seem to have\nwrapped at around 50 columns?\n"},{"id":"166212","messageId":"7vk4enusvt.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"4e4fea2a-c9fe-47ff-b947-64aa4662adae-mfwitten@gmail.com","subject":"Re: [RFC 3/5] Date Mode: Implementation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-21T22:44:22Z","receivedAt":"2011-04-21T22:44:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n> Date: Sat, 12 Feb 2011 03:56:17 +0000\n> This introduces and employs infrastructure for manipulating\n> and bundling time zone and date format specifications in\n> code, on the command line, and in git configuration files.\n>\n> In particular, this commit includes the following:\n\nEven though I think it is going in the right direction to separate \"in\nwhat timezone do we show timestamps (original vs user-specified)\" and \"in\nwhat format do we show them (short? with tz? like in e-mail? iso? etc.),\nthis particular commit seems to do too many things at once.\n\nCan you think of a way split this into smaller steps?  I am not asking\n\"Could you pretty please split this?\" nor \"Are you willing to do so?\"\nI am asking if the task is possible to begin with.\n\nA valid answer could be \"everything is so intertwined that this patch is\nthe smallest logical unit of change\", and I would be somewhat sympathetic\nto that.  Once you change the type of revs->date_mode from the current\nsingle scalar to a struct, all the callers need to change the way they\ninitialize and update the field, and I understand that such a change would\nhave to touch a major part of the system.\n\nBut if that step can be done without changing the semantics nor behaviour\nat all, it would be easier to review and verify. The the next patch can\nenhance the struct in revs->date_mode to express timezone information as a\nnew field, opening the door to the new command line option.\n\n> Essentially, what was:\n>\n>   git log --date=local\n>\n> should now be:\n>\n>   git log --time-zone=local\n\nThe above _should_ read something like:\n\n\t\"git log --date=local\"\n\n        is now a short-hand for\n\n        \"git log --date-format=local --time-zone=local\"\n\n        It specifies that the timestamps should be stringified using the\n        local timezone, and the value should be shown like \"Tue Apr 19\n        12:34:56 2011\" without the timezone.\n\n        \"git log --time-zone=local\" would give the same output but you\n        will also see the timezone, e.g. \"Tue Apr 19 12:34:56 2011 -0800\",\n        because --date-format defaults to \"default\".\n\nIn other words, this new feature should allow people who do not care about\nit to keep saying \"--date=local\" without being told that they now _should_\nsay things differently.\n\nIf it is absolutely impossible to implement the separation between the\ntimezone and the format without breaking existing option handling, we\nwould have to consider if the new feature (i.e. separation of zone and\nformat) is worth breaking scripts and existing users, and we may end up\nrejecting the implementation of new feature.  I however do think this\nparticular feature is possible to implement without such a regression.\n\nThis patch makes the date-related infrastructure rich enough to deserve\nits own \"date.h\" that is included by \"cache.h\" near the beginning of it.\nThe documentation part in [4/5] has such a separation, which I think is a\nsensible thing to do, except that date-mode-docs.txt is probably a wrong\nname for the file.  If you followed the precedence set by most other\nincludable pieces about the set of options, you would probably call it\ndate-opts.txt or something.\n\n> diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\n> index 60d6b32..add9299 100644\n> --- a/builtin/for-each-ref.c\n> +++ b/builtin/for-each-ref.c\n> @@ -361,26 +360,58 @@ static const char *copy_email(const char *buf)\n>  \treturn xmemdupz(email, eoemail + 1 - email);\n>  }\n>  \n> +#define PARSE_DATE_MODE(marker_0, parser_0, date_mode_member_0, \\\n> +                        marker_1, parser_1, date_mode_member_1) \\\n> +\tif (*atomname == marker_0) { \\\n> +\t\tconst char *spec_0 = ++atomname; \\\n> +\t\tdo { \\\n> +\t\t\tif (*atomname == marker_1) { \\\n> +\t\t\t\tdate_mode_member_1 = parser_1(atomname+1); \\\n> +\t\t\t\tchar *spec_0_dup  = xmemdupz(spec_0, atomname - spec_0); \\\n> +\t\t\t\tdate_mode_member_0 = parser_0(spec_0_dup); \\\n> +\t\t\t\tfree(spec_0_dup); \\\n> +\t\t\t\tgoto finish; \\\n> +\t\t\t} \\\n\nThis introduces:\n\nbuiltin/for-each-ref.c:386: error: ISO C90 forbids mixed declarations and code\nbuiltin/for-each-ref.c:390: error: ISO C90 forbids mixed declarations and code\n\n> diff --git a/date.c b/date.c\n> index caa14fe..879b0e1 100644\n> --- a/date.c\n> +++ b/date.c\n> @@ -147,40 +147,42 @@ const char *show_date_relative(unsigned long time, int tz,\n>  \treturn timebuf;\n>  }\n>  \n> -const char *show_date(unsigned long time, int tz, enum date_mode mode)\n> +const char *show_date(unsigned long time, int tz, struct date_mode date_mode)\n>  {\n> ...\n\nI may be being old-fashioned, but I'd really prefer to see structures\npassed by pointer, not by value, even if the structure starts out as a\nsmall container for just two enum fields.  There are a few other places\nyou pass this structure by value.\n\n> @@ -653,7 +655,7 @@ int parse_date(const char *date, char *result, int maxlen)\n>  \treturn date_string(timestamp, offset, result, maxlen);\n>  }\n>  \n> -enum date_mode parse_date_format(const char *format)\n> +enum date_format parse_date_format(const char *format)\n>  {\n>  \tif (!strcmp(format, \"relative\"))\n>  \t\treturn DATE_RELATIVE;\n> @@ -675,6 +677,67 @@ enum date_mode parse_date_format(const char *format)\n>  \t\tdie(\"unknown date format %s\", format);\n>  }\n>  \n> +enum time_zone parse_time_zone(const char *time_zone)\n> +{\n> +\tif (!strcmp(time_zone, \"local\"))\n> +\t\treturn TIME_ZONE_LOCAL;\n> +\telse if (!strcmp(time_zone, \"default\"))\n> +\t\treturn TIME_ZONE_DEFAULT;\n> +\telse\n> +\t\tdie(\"unknown time zone %s\", time_zone);\n> +}\n\nHmm, I was hoping that we can enhance this to allow feeding a string\n(e.g. \"GMT\", \"+0900\"), but \"enum time_zone\" makes it almost impossible.\n\n> +int parse_date_mode_config_internal(const char *var_date,\n> +                                     const char *var_timezone,\n> +                                     const char *var,\n> +                                     const char *value,\n> +                                     struct date_mode *d,\n> +                                     int *ret)\n> +{\n\nI'd rather see you drop the preprocessor trick to synthesize \"blame.date\"\nand \"blame.timezone\" out of \"blame\", drop _internal from this function\n(which is not static to the file scope to begin with), and take a single\n\"const char *var\" as the first parameter.  Otherwise, future users of the\nAPI cannot pass a variable to (your version of) parse_date_mode_config().\nIt is not implausible that someday somebody might want to parse per-branch\ntimezone specification out of \"branch.master.timezone\", and most likely\n\"branch.master\" part would be created runtime in a strbuf, not limited to\nhardcoded program names such as \"blame\".\n\nNo other config callback function uses \"a pointer to int as an argument to\nstore the return value\"; if you absolutely need a new calling convention,\nit needs to be documented better.  What do *ret and the return value from\nthis function mean from the caller's point of view?\n\nThanks.\n"},{"id":"166213","messageId":"7vd3kfusva.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"bbf61df6-b7fa-429e-866e-899354953cbd-mfwitten@gmail.com","subject":"Re: [RFC 5/5] Date Mode: Tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-21T22:44:41Z","receivedAt":"2011-04-21T22:44:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I'd like to have part of the tests in this patch at the beginning of the\nseries to document and protect the behaviour of the current --date related\noptions, then your enhancement that adds --zone that lets the users\nspecify the timezone and the format independently, and finally the\nremainder of this patch as an addition to the test script to document and\nprotect the interaction between the two options (e.g. what happens when\nnone or only one is specified? what happens when conflicting options such\nas \"--date=local --zone=gmt\" is given?).\n\nThanks.\n"},{"id":"166222","messageId":"811b01a9-f10e-4444-9e5e-581adaf059c2-mfwitten@gmail.com","threadId":"27144","inReplyTo":"7vtydrutbq.fsf@alter.siamese.dyndns.org","subject":"Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL)","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-22T14:08:42Z","receivedAt":"2011-04-22T14:08:42Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, 21 Apr 2011 15:34:49 -0700, Junio C Hamano wrote:\n\n> Michael Witten <mfwitten@gmail.com> writes:\n>\n>> Date: Fri, 11 Feb 2011 16:06:36 +0000\n>> Currently, when the date mode is DATE_LOCAL, the\n>> time zone is never pretty printed;...\n>\n> This is a tangent but it is funny to see the unnecessary Date: in-body\n> header for a series about date display.  Please drop it.\n\nNo.\n\n> Backdating the author timestamp will make it harder to find the related\n> discussion from the list archive; the only plausible benefit I can see is\n> that you may get \"I thought of this much earlier than when I posted it to\n> the public for the first time\" pee-in-the-snow value out of doing so, but\n> that is done at the cost to all others who need to inspect the history\n> later.  Please don't.\n\nWhat if I had submitted a pull request instead of inlined patches? Would\nyou be asking me to wipe the dates in my repository? Would you rewrite\nthe commits on your end?\n\nLet's suppose that I like backdating specifically for the \"pee-in-the-snow\"\nvalue; well, that's one of the prime motivators for doing unpaid, volunteer\nwork, and that's one of the reasons that distributed SCM tools like git are\nso great: Unlike with, say, CVS, the actual author gets his or her information\nofficially recorded.\n\nPerhaps you think we should dispense with identity information as well, given\nthat it's just a pee-in-the-snow value...\n\nBUT WAIT!\n\nNames and email addresses are important because of copyright issues; we need\nto know whence came a contribution, after all.\n\nWell... don't you think the particular date at which something was written\nmight be similarly valuable in a dispute over copyright?\n\nJunio, you'll take my pee-in-the-snow and you'll like it.\n\n> As a future reference, when you have a valid reason to override the\n> header information your MUA would give your message with an in-body\n> header, please leave a blank line after the in-body header to make the\n> result easier to read, like this:\n>\n>         Date: Fri, 11 Feb 2011 16:06:36 +0000\n>\n>         Currently, when the date mode is DATE_LOCAL, the\n>         time zone is never pretty printed;...\n\nFair enough.\n\n> Also paragraphs that wrap lines at too narrow a margin is just as hard to\n> read as paragraphs wrapped at a margin that is too wide.\n\nI disagree that\nit's too narrow,\nand I feel like\nyou are now\nnitpicking.\n\nSincerely,\nMichael Witten\n"},{"id":"166221","messageId":"08195d5d-bd90-49d3-a1a6-63be0d833110-mfwitten@gmail.com","threadId":"27144","inReplyTo":"7vtydrutbq.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-22T14:36:13Z","receivedAt":"2011-04-22T14:36:13Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, 21 Apr 2011 15:34:49 -0700, Junio C Hamano wrote:\n\n> Michael Witten <mfwitten@gmail.com> writes:\n>\n>> Date: Fri, 11 Feb 2011 16:06:36 +0000\n>> Currently, when the date mode is DATE_LOCAL, the\n>> time zone is never pretty printed;...\n>\n> I am not opposed to have a new mode that shows timestamps in local\n> timezone with zone information, but this change is a regression to people\n> who have known and relied upon that asking for timestamps in their local\n> timezone will give everything in the local timezone and result in a short\n> output by the virtue of not needing to repeat the zone string, as they are\n> the same (this is not strictly true near your dst boundary, and that is\n> why I am open to the idea as a separate option).\n\nAllow me to restate what I think you are saying:\n\nHow about having [the still deprecated] --date=local (that is, DATE_LOCAL)\noption produce the old behavior, but have every combination of date mode\noptions that does not involve DATE_LOCAL always emit the time zone.\n\nIn other words, all of these do not emit a time zone:\n\n  --date=local\n  --date=local --time-zone=local\n  --date=local --time-zone=default   # --time-zone is ignored for simplicity.\n\nand all of these always emit a time zone:\n\n  --date=default\n  --date=rfc\n  --date=rfc2822\n  --date=iso\n  --date=iso8601\n  --date=short\n  --date=raw\n  --date=default --time-zone=default\n  --date=rfc     --time-zone=default\n  --date=rfc2822 --time-zone=default\n  --date=iso     --time-zone=default\n  --date=iso8601 --time-zone=default\n  --date=short   --time-zone=default\n  --date=raw     --time-zone=default\n  --date=default --time-zone=local\n  --date=rfc2822 --time-zone=local\n  --date=rfc     --time-zone=local\n  --date=iso     --time-zone=local\n  --date=iso8601 --time-zone=local\n  --date=short   --time-zone=local\n  --date=raw     --time-zone=local\n                 --time-zone=local\n                 --time-zone=default\n"},{"id":"166223","messageId":"7vvcy6tjf1.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"08195d5d-bd90-49d3-a1a6-63be0d833110-mfwitten@gmail.com","subject":"Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-22T15:06:26Z","receivedAt":"2011-04-22T15:06:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n> Allow me to restate what I think you are saying:\n>\n> How about having [the still deprecated] --date=local (that is, DATE_LOCAL)\n> option produce the old behavior, but have every combination of date mode\n> options that does not involve DATE_LOCAL always emit the time zone.\n>\n> In other words, all of these do not emit a time zone:\n>\n>   --date=local\n>   --date=local --time-zone=local\n>   --date=local --time-zone=default   # --time-zone is ignored for simplicity.\n\nYeah.  It is even plausible to extend --date further so that we can\nexpress things like\n\n    --date='%a %b %d %H:%M:%S %Y'\n    --date='%a %b %d %H:%M:%S %Y %z'\n\nThe former would be equivalent to --date[-format]=local, the latter would\nbe equivalent to --date[-format]=default.\n\nOr something like that [warning: without morning caffeine yet] :-) \n"},{"id":"166234","messageId":"f1ad6d6f-44c8-442c-a335-d0b4113c48d7-mfwitten@gmail.com","threadId":"27144","inReplyTo":"7vd3kfusva.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC 5/5] Date Mode: Tests","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-23T03:42:24Z","receivedAt":"2011-04-23T03:42:24Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, 21 Apr 2011 15:44:41 -0700, Junio C Hamano wrote:\n\n> I'd like to have part of the tests in this patch at the beginning of the\n> series to document and protect the behaviour of the current --date related\n> options, then your enhancement that adds --zone that lets the users\n> specify the timezone and the format independently, and finally the\n> remainder of this patch as an addition to the test script to document and\n> protect the interaction between the two options (e.g. what happens when\n> none or only one is specified? what happens when conflicting options such\n> as \"--date=local --zone=gmt\" is given?).\n\nI would split it up as requested, but I'm not sure that it's worthwhile; while\nthere is a certain appeal to such a natural progression, my feeling is that\nthe separate patches won't turn out to be usefully smaller (and thus more\neasily verified, as I'm sure you desire), because every data structure and\ncode path deals with both simultaneously.\n\nMoreover, the beauty of your proposed progression is lost on the fact that\nthese patches will be applied so close in time to each other; why bother\ndealing with solely date mode formats when such a version will almost\ncertainly never be used?\n\nThus, it seems cleaner just to introduce the whole set of tests in one go.\n"},{"id":"166235","messageId":"453b72ab-40cc-431b-9865-3080c250a7dd-mfwitten@gmail.com","threadId":"27144","inReplyTo":"7vd3kfusva.fsf@alter.siamese.dyndns.org","subject":"Time zone option name (Re: [RFC 5/5] Date Mode: Tests)","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-23T03:45:51Z","receivedAt":"2011-04-23T03:45:51Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Thu, 21 Apr 2011 15:44:41 -0700, Junio C Hamano wrote:\n\n> I'd like to have part of the tests in this patch at the beginning of the\n> series to document and protect the behaviour of the current --date related\n> options, then your enhancement that adds --zone that lets the users\n> specify the timezone and the format independently, and finally the\n> remainder of this patch as an addition to the test script to document and\n> protect the interaction between the two options (e.g. what happens when\n> none or only one is specified? what happens when conflicting options such\n> as \"--date=local --zone=gmt\" is given?).\n\nI'd like to clarify what you intend the new time zone option to be named; my\npatch series currently uses `--time-zone' (which is admittedly long), but it\nwould appear here that you find `--zone' attractive. My only qualm there is\nthat `zone' is such a rich word; not only is it somewhat incomprehensible out\nof context, but it also might be useful for something else in the future.\n"},{"id":"166236","messageId":"634e602c-d8cf-469d-a241-bda689715ade-mfwitten@gmail.com","threadId":"27144","inReplyTo":"bbf61df6-b7fa-429e-866e-899354953cbd-mfwitten@gmail.com","subject":"Re: [RFC 5/5] Date Mode: Tests","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-23T03:59:11Z","receivedAt":"2011-04-23T03:59:11Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Wed, 20 Apr 2011 02:45:23 +0000, Michael Witten wrote:\n\n> +\tforeach (@formats) {\n> +\t\t$expected{''} = $expected{$ARGV[2]};\n> +\t}\n\nWoops!\n\nWell, I guess nobody read through this patch (including myself) :-P\n"},{"id":"166237","messageId":"fdb4707e-125d-4e60-964e-b972386f0e85-mfwitten@gmail.com","threadId":"27144","inReplyTo":"f1ad6d6f-44c8-442c-a335-d0b4113c48d7-mfwitten@gmail.com","subject":"Re: [RFC 5/5] Date Mode: Tests","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2011-04-23T05:06:02Z","receivedAt":"2011-04-23T05:06:02Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Sat, 23 Apr 2011 03:42:24 +0000\n\n> On Thu, 21 Apr 2011 15:44:41 -0700, Junio C Hamano wrote:\n>\n>> I'd like to have part of the tests in this patch at the beginning of the\n>> series to document and protect the behaviour of the current --date related\n>> options, then your enhancement that adds --zone that lets the users\n>> specify the timezone and the format independently, and finally the\n>> remainder of this patch as an addition to the test script to document and\n>> protect the interaction between the two options (e.g. what happens when\n>> none or only one is specified? what happens when conflicting options such\n>> as \"--date=local --zone=gmt\" is given?).\n>\n> I would split it up as requested, but I'm not sure that it's worthwhile;\n> while there is a certain appeal to such a natural progression, my feeling\n> is that the separate patches won't turn out to be usefully smaller (and\n> thus more easily verified, as I'm sure you desire), because every data\n> structure and code path deals with both simultaneously.\n\nMaybe I spoke to soon; let me play around with it.\n\nStill, though:\n\n> Moreover, the beauty of your proposed progression is lost on the fact that\n> these patches will be applied so close in time to each other; why bother\n> dealing with solely date mode formats when such a version will almost\n> certainly never be used?\n>\n> Thus, it seems cleaner just to introduce the whole set of tests in one go.\n"},{"id":"166238","messageId":"7vfwp9mt9k.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"453b72ab-40cc-431b-9865-3080c250a7dd-mfwitten@gmail.com","subject":"Re: Time zone option name (Re: [RFC 5/5] Date Mode: Tests)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-23T05:27:51Z","receivedAt":"2011-04-23T05:27:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n> I'd like to clarify what you intend the new time zone option to be named; my\n> patch series currently uses `--time-zone' (which is admittedly long), but it\n> would appear here that you find `--zone' attractive.\n\nSorry, that was just me being sloppy, writing barely enough for you and\nreaders to be able to tell which one of the two options you used in your\npatch is what I was referring to.\n\nThe word \"zone\" may mean something other than timezone in future versions\nof git, and I do not want to see us regret this feature squatting on a\nshort and sweet \"--zone\" option if/when it happens.  Your \"--time-zone\"\n(or a single-word \"--timezone\") would be far better.\n\nThe \"--date={local,default,short,...}\" option might want to have a longer\nsynonym \"--date-format={...ditto...}\", as some commands take the value of\nthe timestamp as a parameter to their \"--date=\" option, but that is minor\nand definitely should not be part of this series.\n\nThanks.\n"},{"id":"166297","messageId":"87sjt76rzo.fsf@catnip.gol.com","threadId":"27144","inReplyTo":"811b01a9-f10e-4444-9e5e-581adaf059c2-mfwitten@gmail.com","subject":"Re: Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL)","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2011-04-25T01:26:35Z","receivedAt":"2011-04-25T01:26:35Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n> and I feel like\n> you are now\n> nitpicking.\n\nWait, isn't nitpicking his job?!\n\n-miles\n\n-- \nApologize, v. To lay the foundation for a future offense.\n"},{"id":"166299","messageId":"7vhb9nkmo1.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"87sjt76rzo.fsf@catnip.gol.com","subject":"Re: Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-25T03:57:50Z","receivedAt":"2011-04-25T03:57:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Miles Bader <miles@gnu.org> writes:\n\n> Michael Witten <mfwitten@gmail.com> writes:\n>> and I feel like\n>> you are now\n>> nitpicking.\n>\n> Wait, isn't nitpicking his job?!\n\nEnforcing consistency is one of the important tasks the maintainers do in\ntheir projects.  Besides ensuring that the intent of the change each patch\nbrings to the codebase is good, that the log entry describes the change in\na useful way for future readers, and that the patch correctly implements\nthe described change, we also need to make sure that the resulting code\nmatches the style of the surrounding code, and the style, structure and\ntone the log messages are delivered in a consistent voice.  Otherwise it\nwould quickly get very tiring when you have to dig into the history of the\ncodebase.  The code and the history are read a lot more often than are\nwritten.\n\nWhen a casual and occasional contributor sends in a good change whose only\nsin is style violation, I do not mind touching up its proposed commit log\nmessage or the patch text, and I often do.\n\nBut I expect contributors who return here often to be more considerate\nthan one-time contributors, and that is why I give style reminders.\n\nThe purpose of the style reminder is so that they can help me and other\nreviewers concentrate on the substance (Is what it does good? Is it\nexplained well? Is it implemented well?) without having to spend\nunnecessary time fixing the form (Does the new code fit well with the\nsurrounding code? Does the message flow well in \"git log\" and easy to\nunderstand?) when they submit their changes the next time.\n\nPlease do not mistake a style reminder as an opportunity to promote your\nown style that would not match what we have established here.  I could\nmake a black-list of people I should avoid giving style reminders and\ninstead fix all of their submissions silently, because giving style\nremainders to them will waste people's time by creating a discussion\nthread like this one.\n\nI really wish I do not have to do so.\n\nSuch an arrangement would not scale.  Given two sets of patches with equal\ngoodness in substance, if one also matches our style and the other\ndeliberately asks me to spend extra time to whip it into our style, the\nlatter naturally has to be assigned a lower priority.  After all, there is\nonly 24 hours in a day, and my time is better spent on substance not form,\nand definitely not on responding to quibblings about styles.\n\nThe only two \"workable\" solutions are either (1) everybody tries to be\nconsistent with the project's style, or (2) allow everybody to stick to\ntheir own style, making the resulting code and history unpleasant to read.\n\nI'd be failing the community if I took the latter approach.\n"},{"id":"166310","messageId":"m3bozuwqyz.fsf@localhost.localdomain","threadId":"27144","inReplyTo":"7vhb9nkmo1.fsf@alter.siamese.dyndns.org","subject":"Re: Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-04-25T10:45:03Z","receivedAt":"2011-04-25T10:45:03Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Enforcing consistency is one of the important tasks the maintainers do in\n> their projects.  Besides ensuring that the intent of the change each patch\n> brings to the codebase is good, that the log entry describes the change in\n> a useful way for future readers, and that the patch correctly implements\n> the described change, we also need to make sure that the resulting code\n> matches the style of the surrounding code, and the style, structure and\n> tone the log messages are delivered in a consistent voice.  Otherwise it\n> would quickly get very tiring when you have to dig into the history of the\n> codebase.  The code and the history are read a lot more often than are\n> written. [...]\n\nThis information should be put e.g. in SubmittingPatches, or\nCodingGuidelines, or MaintNotes, isn't it?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"166321","messageId":"7vipu2jiah.fsf@alter.siamese.dyndns.org","threadId":"27144","inReplyTo":"m3bozuwqyz.fsf@localhost.localdomain","subject":"Re: Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-25T18:29:58Z","receivedAt":"2011-04-25T18:29:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Enforcing consistency is one of the important tasks the maintainers do...\n>\n> This information should be put e.g. in SubmittingPatches, or\n> CodingGuidelines, or MaintNotes, isn't it?\n\nThe above \"we value consistency\" should be already inferrable by reading\nSubmittingPatches and CodingStyle in reverse?  If it were up to the\ncontributors to ignore them, there is no point to have these guides to\nbegin with.\n\nIf we want to keep these words somewhere, I think the place to put it\nwould probably be the Policy section of Doc/howto/maintain-git.txt.\n"}]}