git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] pretty: Provide a strict ISO8601 date format

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 29, 2014, 18:59 UTC
Message-ID
<xmqqwq9r5dhb.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1409331522-8457-1-git-send-email-bbolli@ewanet.ch>
Beat Bolli <bbolli@ewanet.ch> 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.
Show 9 quoted lines
> +	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.
Show 6 quoted lines
> +# 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) &&
Previous: Beat BolliNext: Junio C Hamano
Message 2 of 7 in “pretty: Provide a strict ISO8601 date format”
  1. pretty: Provide a strict ISO8601 date formatBeat Bolli, Aug 29, 2014
  2. Junio C HamanoAug 29, 2014
  3. Junio C HamanoAug 29, 2014
  4. Andreas SchwabAug 29, 2014
  5. Beat BolliAug 29, 2014
  6. Beat BolliAug 29, 2014
  7. Jeff KingAug 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.