From 466fb6742d7fb7d3e6994b2d0d8db83a8786ebcf Mon Sep 17 00:00:00 2001 From: Beat Bolli Date: Fri, 29 Aug 2014 18:58:42 +0200 Subject: pretty: provide a strict ISO 8601 date format Git's "ISO" date format does not really conform to the ISO 8601 standard due to small differences, and it cannot be parsed by ISO 8601-only parsers, e.g. those of XML toolchains. The output from "--date=iso" deviates from ISO 8601 in these ways: - a space instead of the `T` date/time delimiter - a space between time and time zone - no colon between hours and minutes of the time zone Add a strict ISO 8601 date format for displaying committer and author dates. Use the '%aI' and '%cI' format specifiers and add '--date=iso-strict' or '--date=iso8601-strict' date format names. See http://thread.gmane.org/gmane.comp.version-control.git/255879 and http://thread.gmane.org/gmane.comp.version-control.git/52414/focus=52585 for discussion. Signed-off-by: Beat Bolli Signed-off-by: Junio C Hamano --- pretty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pretty.c') diff --git a/pretty.c b/pretty.c index 3a1da6fd32..7dd5601e64 100644 --- a/pretty.c +++ b/pretty.c @@ -731,9 +731,12 @@ static size_t format_person_part(struct strbuf *sb, char part, case 'r': /* date, relative */ strbuf_addstr(sb, show_ident_date(&s, DATE_RELATIVE)); return placeholder_len; - case 'i': /* date, ISO 8601 */ + case 'i': /* date, ISO 8601-like */ strbuf_addstr(sb, show_ident_date(&s, DATE_ISO8601)); return placeholder_len; + case 'I': /* date, ISO 8601 strict */ + strbuf_addstr(sb, show_ident_date(&s, DATE_ISO8601_STRICT)); + return placeholder_len; } skip: -- cgit v1.2.1