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

Re: [PATCH/RFC] New date format: local_original

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 7, 2009, 20:01 UTC
Message-ID
<7vocojrn26.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20091007125427.GA20067@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> If the former, then should the options be orthogonal? That is, should it
> be a new format combining the two, or should it be an option to show, in
> your preferred format, the time in both local and original time zones?
> E.g., something like:
>
>   $ git log --date=iso --local-dates-too
>   commit bf01a69ed40e1afcf56aff143f7523da2ce263ed
>   Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>   Date:   2009-10-04 00:41:55 +0200
>   Local:  2009-10-03 17:41:55 -0500
>
> And then you can use it with "normal" dates, iso dates, rfc2822 dates,
> etc.
Thanks for comments.

I think "--date=iso --local-dates-too" is still not orthogonal enough, let alone "local_original" which invites "Why is this combination supported and not this, that, and 47 others?" questions.

I however do not think it is so bad an idea to allow something like:
	git log --date='custom:%Y-%m-%d ...'
	git log --date=custom	;# looks at "date.custom" config

You (not Peff, but figuratively whoever wants to implement it) can add a mechanism to specify in which timezone (original or local) you would want the timestring to be given, and make what Tuomas's RFC patch does a mere special case. For example, we could reuse 'date "+format"' string with our own extension %{magic}, with two magic tokens initially defined:

    %{local}	interpret timestamp in local zone from now on
    %{original}	interpret timestamp in the original zone from now on
With such a mechanism Tuomas can define:
	[date]
            custom=%{local}%a %Y-%m-%d %H:%M:%S %{original}(%a %H:%M:%S %z)
and ask "git log --date=custom" to get what his patch does.
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “New date format: local_original”
  1. New date format: local_originalTuomas Suutari, Oct 6, 2009
  2. Jeff KingOct 7, 2009
  3. Junio C HamanoOct 7, 2009
  4. Jeff KingOct 7, 2009

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.