{"thread":{"id":"25554","subject":"add UTC option for pretty-formats","startedAt":"2010-10-27T01:32:21Z","lastAt":"2010-11-08T08:41:50Z","messageCount":2,"participants":["Jeff Carr","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"154470","messageId":"AANLkTikN_B-bUTyy5440AVwTD=KkUWdkf_ukRszTuhYG@mail.gmail.com","threadId":"25554","inReplyTo":null,"subject":"add UTC option for pretty-formats","fromName":"Jeff Carr","fromEmail":"basilarchia@gmail.com","sentAt":"2010-10-27T01:32:21Z","receivedAt":"2010-10-27T01:32:21Z","isPatch":false,"sender":{"key":"basilarchia@gmail.com","avatar":null},"body":"Adds displaying author and commit times in UTC using %au and %cu.\n\n\ncommit 99a429c3e369ca76113a8642f80245d7644b9a2f\nAuthor: Jeff Carr <jcarr@basilarchia@gmail.com>\nDate:   Tue Oct 26 18:25:06 2010 -0700\n\n    Adds a UTC option to the pretty formats\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 561cc9f..df56147 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -114,6 +114,7 @@ The placeholders are:\n - '%ar': author date, relative\n - '%at': author date, UNIX timestamp\n - '%ai': author date, ISO 8601 format\n+- '%au': author date, UTC\n - '%cn': committer name\n - '%cN': committer name (respecting .mailmap, see linkgit:git-shortlog[1] or linkgit:git-blame[1])\n - '%ce': committer email\n@@ -123,6 +124,7 @@ The placeholders are:\n - '%cr': committer date, relative\n - '%ct': committer date, UNIX timestamp\n - '%ci': committer date, ISO 8601 format\n+- '%cu': committer date, UTC\n - '%d': ref names, like the --decorate option of linkgit:git-log[1]\n - '%e': encoding\n - '%s': subject\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 1015354..33b04e6 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -2343,6 +2343,9 @@ parse_done:\n \tcase DATE_SHORT:\n \t\tblame_date_width = sizeof(\"2006-10-19\");\n \t\tbreak;\n+\tcase DATE_UTC:\n+\t\tblame_date_width = sizeof(\"Fri Mar 12 20:18:53 UTC 2010\");\n+\t\tbreak;\n \tcase DATE_RELATIVE:\n \t\t/* \"normal\" is used as the fallback for \"relative\" */\n \tcase DATE_LOCAL:\ndiff --git a/cache.h b/cache.h\nindex 33decd9..a46965d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -812,6 +812,7 @@ enum date_mode {\n \tDATE_LOCAL,\n \tDATE_ISO8601,\n \tDATE_RFC2822,\n+\tDATE_UTC,\n \tDATE_RAW\n };\n \ndiff --git a/date.c b/date.c\nindex 00f9eb5..64bbce0 100644\n--- a/date.c\n+++ b/date.c\n@@ -157,6 +157,17 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)\n \t\treturn timebuf;\n \t}\n \n+\tif (mode == DATE_UTC) {\n+\t\ttm = time_to_tm(time, 0);\n+\t\tsprintf(timebuf, \"%.3s %.3s %2d %02d:%02d:%02d UTC %d\",\n+\t\t\tweekday_names[tm->tm_wday],\n+\t\t\tmonth_names[tm->tm_mon],\n+\t\t\ttm->tm_mday,\n+\t\t\ttm->tm_hour, tm->tm_min, tm->tm_sec,\n+\t\t\ttm->tm_year + 1900);\n+\t\treturn timebuf;\n+\t}\n+\n \tif (mode == DATE_RELATIVE) {\n \t\tstruct timeval now;\n \t\tgettimeofday(&now, NULL);\ndiff --git a/pretty.c b/pretty.c\nindex f85444b..9903a12 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -531,6 +531,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tcase 'i':\t/* date, ISO 8601 */\n \t\tstrbuf_addstr(sb, show_date(date, tz, DATE_ISO8601));\n \t\treturn placeholder_len;\n+\tcase 'u':\t/* date, UTC */\n+\t\tstrbuf_addstr(sb, show_date(date, tz, DATE_UTC));\n+\t\treturn placeholder_len;\n \t}\n \n skip:\n"},{"id":"155360","messageId":"20101108084150.GB2430@burratino","threadId":"25554","inReplyTo":"AANLkTikN_B-bUTyy5440AVwTD=KkUWdkf_ukRszTuhYG@mail.gmail.com","subject":"Re: add UTC option for pretty-formats","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-11-08T08:41:50Z","receivedAt":"2010-11-08T08:41:50Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Jeff,\n\nJeff Carr wrote:\n\n> --- a/Documentation/pretty-formats.txt\n> +++ b/Documentation/pretty-formats.txt\n> @@ -114,6 +114,7 @@ The placeholders are:\n>  - '%ar': author date, relative\n>  - '%at': author date, UNIX timestamp\n>  - '%ai': author date, ISO 8601 format\n> +- '%au': author date, UTC\n\nWhy not:\n\n\tTZ=UTC git log --format=%ad --date=local\n\nor something like:\n\n\tgit log --format=%AD(rfc2822,tz=UTC)\n\n?  In other words, why should we provide this feature with date=rfc\ndates and not date=iso ones?\n"}]}