From: Shengfa Lin <shengfa@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, jrnieder@gmail.com, nathaniel@google.com,
rsbecker@nexbridge.com, sandals@crustytoothpaste.net,
santiago@nyu.edu, shengfa@google.com
Subject: Re: [WIP v2 1/2] Adding a record-time-zone command option for commit
Date: Mon, 26 Oct 2020 04:14:43 +0000 [thread overview]
Message-ID: <20201026041443.1362933-1-shengfa@google.com> (raw)
In-Reply-To: <xmqqd01ans4h.fsf@gitster.c.googlers.com>
>> Yes, we could check it in datestamp(), but ...
>>
>>> Initially, I thought this would be sufficient to show "-0000" in commit log
>>> message. However, I found that the show_date function is used for "decoding";
>>> converting timestamp and tz to more readable format. Then I realize the
>>> function won't distinguish between +0 and -0 as it only takes in a tz as
>>> argument. As a result,...
>>
>> ... I would have imagined that you do not have to deal with all
>> those complications if you don't hook this to such a low level of
>> the call graph. That is why I wondered:
>> ...
>
> Let me answer some of my puzzlement myself; that is, I would have
> understood the change well if it were explained to me this way, and
> if that explanation matched what the patches did ;-)
Yes, I agree.
> The topic has two major parts.
>
> The code that prepares the timestamp to be recorded for the current
> user, who wants to record an anonymous timezone "-0000", is one (and
> the easier) part. And this part could be done all inside
> ident_default_date() without touching anything in date.c; when we
> need to call datestamp(), we are getting the current time for the
> current user, so we can mask the timezone.
So for this part, there is no need to modify datestamp in dates.c.
We could modify ident_default_date buf after datestamp to set the last
5 bytes to "-0000" using strcpy.
> The other part is that we need to read the timestamp from existing
> records, and if we choose to distinguish between timestamp in UTC
> and timestamp with anonymous timezone, we'd need to devise a way to
> encode the anonymous timezone differently. It is where the extra
> bit that says "this bit does not usually mean anything but only when
> the offset (which is a signed integer whose valid range is set to
> between -2400 to +2400 by date.c::match_tz()) is zero, and this bit
> is set, the zone is anonymous" comes in.
Yes, that's correct.
> Side note. I suspect the damage to the callchain can be
> limited much narrower if we didn't add this bit throughout
> the API. What if we instead pick a number outside the valid
> range of offsets, say -10000, as a sentinel value and passed
> that throughout the code when we want an anonymous zone?
Good idea.
> The functions in the callchain that care about the timezone
> must understand how anonymous zone is encoded anyway, so to
> them it's a matter of using an int plus one bit or using an
> int that can have a special value. But other functions in
> the callchain whose sole purpose (with respect to the
> timezone information) is to pass it between their caller and
> their callee as an opaque piece of data, using just a single
> integer is much less error prone---the patch does not have
> to touch them at all.
That would be easier to follow and requires less changes as well.
> Thanks.
Thanks for the clarification. Now I think we have a much better
understanding. I will try to do a better job describing patches
next time.
next prev parent reply other threads:[~2020-10-26 4:14 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-05 17:14 [ISSUE] Stop accessing, storing, and sharing the user's time zone Nathaniel Manista
2019-12-05 17:31 ` Junio C Hamano
2019-12-05 17:33 ` Randall S. Becker
2019-12-05 17:43 ` Junio C Hamano
2019-12-05 17:53 ` Santiago Torres Arias
2019-12-05 18:00 ` Randall S. Becker
2020-09-30 23:21 ` [RFC PATCH 0/1] adding user.hideTimezone for setting UTC timezone Shengfa Lin
2020-09-30 23:21 ` [RFC PATCH 1/1] hideTimezone: add a user.hideTimezone config Shengfa Lin
2020-09-30 23:41 ` Junio C Hamano
2020-10-01 0:17 ` Junio C Hamano
2020-10-02 6:07 ` Shengfa Lin
2020-10-01 0:31 ` Junio C Hamano
2020-10-01 0:35 ` Junio C Hamano
2020-10-02 6:41 ` Shengfa Lin
2020-10-02 6:46 ` Shengfa Lin
2020-10-02 6:37 ` Shengfa Lin
2020-10-02 6:02 ` Shengfa Lin
2020-10-02 6:15 ` Jonathan Nieder
2020-10-02 22:32 ` Shengfa Lin
2020-10-03 4:57 ` Junio C Hamano
2020-09-30 23:55 ` Junio C Hamano
2020-10-02 6:51 ` Shengfa Lin
2020-10-01 0:05 ` Junio C Hamano
2020-10-01 2:44 ` Jonathan Nieder
2020-10-02 21:17 ` Shengfa Lin
2020-09-30 23:53 ` [RFC PATCH 0/1] adding user.hideTimezone for setting UTC timezone Junio C Hamano
2020-10-01 2:17 ` Junio C Hamano
2020-10-01 3:43 ` Jonathan Nieder
2020-10-01 15:48 ` Junio C Hamano
2020-10-08 19:49 ` Junio C Hamano
[not found] ` <CAEOYnASgxCE5NjhoSgDwyQyAmdLhw5UyFq_Fu==8q7y6uXGz6w@mail.gmail.com>
2020-10-09 16:48 ` Junio C Hamano
2020-10-02 21:56 ` Shengfa Lin
2020-10-02 22:06 ` Junio C Hamano
2020-10-03 3:50 ` Shengfa Lin
2020-10-03 4:42 ` Junio C Hamano
2020-10-03 19:53 ` brian m. carlson
2020-10-03 22:14 ` Junio C Hamano
2020-10-02 21:42 ` Shengfa Lin
2020-10-02 21:23 ` Shengfa Lin
2020-10-13 5:28 ` [WIP v2 0/2] experiment with commit option record-time-zone Shengfa Lin
2020-10-13 5:28 ` [WIP v2 1/2] Adding a record-time-zone command option for commit Shengfa Lin
2020-10-13 20:03 ` Junio C Hamano
2020-10-21 5:01 ` Shengfa Lin
2020-10-21 18:55 ` Junio C Hamano
2020-10-22 16:27 ` Junio C Hamano
2020-10-26 4:14 ` Shengfa Lin [this message]
2020-10-13 5:28 ` [WIP v2 2/2] Demonstrate failing and passing tests Shengfa Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201026041443.1362933-1-shengfa@google.com \
--to=shengfa@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=nathaniel@google.com \
--cc=rsbecker@nexbridge.com \
--cc=sandals@crustytoothpaste.net \
--cc=santiago@nyu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.