From: Junio C Hamano <gitster@pobox.com>
To: Shengfa Lin <shengfa@google.com>
Cc: git@vger.kernel.org, jrnieder@gmail.com, nathaniel@google.com,
rsbecker@nexbridge.com, sandals@crustytoothpaste.net,
santiago@nyu.edu
Subject: Re: [WIP v2 1/2] Adding a record-time-zone command option for commit
Date: Wed, 21 Oct 2020 11:55:20 -0700 [thread overview]
Message-ID: <xmqqzh4f76jr.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20201021050146.3001222-1-shengfa@google.com> (Shengfa Lin's message of "Wed, 21 Oct 2020 05:01:46 +0000")
Shengfa Lin <shengfa@google.com> writes:
> Thanks for the comments and sorry for not describing the design.
> I will add it here.
Thanks. Please do not forget to add it to the updated patch, too.
That's where it matters most---you do not necessarily have to
explain things to _me_, but you should, to everybody who will read
"git log" in the future in order to understand what we did and why.
> First, I would like to use a "global" variable to keep track of whether
> record-time-zone is set and default to true. Then in various places such
> as commit, pull, merge and rebase; we can add command option that can
> modify this value.
>
> Then in datestamp in date.c, we can check this value; offset would be
> initialized to 0 and only be set if record_time_zone is true. Additionally,
> date_string from the same file would take an extra argument to indicate if
> we want to use nagative sign for zero offset. Then the timestamp along with
> sign and 4 digits offset would be stored in "git_default_date" as buf
> "1603255519 -0000". I think of this as the "encoding" step.
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:
>> I may be totally off, ... but wouldn't it be just the
>> matter of touching the single callsite of datestamp() in ident.c, so
>> that after it gets git_default_date string filled, null out the last
>> 5 bytes in it with "-0000" if record_tz is off?
Without any change to datestamp() you made in the patch, the call to
the function from ident.c may give us back a string that ends with
the integer that is the number of seconds since epoch, and sign plus
4 digits, e.g. +0900 or -0800, that would reveal the true timezone.
I would have thought that these five bytes can be replaced with
-0000 under some condition (including "the global is set" which is a
sign that the feature is being used, but not limited to that one---
we may need to make sure the call to ident_default_date() to fill
git_default_date.buf is done on behalf of the user to get a new
timestamp to record the user's activity, not doing something like
"git commit -C <existing commit>"). I do not immediately see a
reason why such a change near the surface level, which does not
disrupt the workings of the code at lower levels, would not work.
Thanks.
next prev parent reply other threads:[~2020-10-21 18:55 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 [this message]
2020-10-22 16:27 ` Junio C Hamano
2020-10-26 4:14 ` Shengfa Lin
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzh4f76jr.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=nathaniel@google.com \
--cc=rsbecker@nexbridge.com \
--cc=sandals@crustytoothpaste.net \
--cc=santiago@nyu.edu \
--cc=shengfa@google.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).