Re: [PATCH v2] pretty: Provide a strict ISO8601 date format
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:02:23
Beat Bolli [off-list ref] writes:
Subject: Re: [PATCH v2] pretty: Provide a strict ISO8601 date format
"pretty: add --date=iso-strict, a strict ISO-8601 date format"
The differences between the two formats are the following:
"The --date=iso format Git uses deviates from ISO-8601 in these ways" may make it clear which one has "T" and which doesn't.
- 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
This commit adds a strict ISO 8601 date format for displaying committer and author dates. It uses the '%aI' and '%cI' format specifiers (note the uppercase 'I') and the '--date=iso-strict' or '--date=iso8601-strict' date format names.
"Add a .... author dates. Use '%aI' and '%cI' format specifiers ...".
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.
Thanks for the pointers, especially for the older one.
+ else if (mode == DATE_ISO8601_STRICT) {
+ char sign = (tz >= 0) ? '+' : '-';
+ tz = abs(tz);
+ strbuf_addf(&timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
+ tm->tm_year + 1900,
+ tm->tm_mon + 1,
+ tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec,
+ sign, tz / 100, tz % 100);OK.
+# ISO strict date format +test_expect_success 'ISO and ISO-strict date formats display the same values' ' + git log --format=%ai%n%ci | sed -e "s/ /T/; s/ //; s/..\$/:&/" >expected && + git log --format=%aI%n%cI >actual && + test_cmp expected actual +'
This is saying that as long as --date=iso-strict format is bug-to-bug compatible with --date=iso format it is OK. Which is fine, especially knowing the implementation ;-)
+ # get new digests (with no abbreviations) head1=$(git rev-parse --verify HEAD~0) && head2=$(git rev-parse --verify HEAD~1) &&