Gitaly doesn't preserve the timezone in commits

Noted by @vsizov when working on gitlab-elasticsearch-indexer!13 (merged)

The author and committer of a git commit includes a name, an email, and a date. That date is expressed with a timezone. So, even though several of the following values have the same timestamp, they are all distinct:

  • 2018-01-01 00:00:00 -0100
  • 2018-01-01 00:00:00 +0000
  • 2018-01-01 00:00:00 +0100
  • 2018-01-01 00:01:00 -0100
  • 2018-01-01 00:01:00 +0000
  • 2018-01-01 00:01:00 +0100

I'm not sure if Gitaly drops the timezone information entirely, or converts the time correctly to UTC first. I'd hope and expect the latter :)

This isn't a huge data integrity issue either way, but it does mean we fail to display information encoded in Git. I think it would be better if Gitaly reported the timezone along with the timestamp.

Given the current protocol details: https://gitlab.com/gitlab-org/gitaly-proto/blob/master/shared.proto#L51

I suggest that we continue to pass the actual time as a UTC-based timestamp, and add another field that passes the actual timezone. We can then transform the UTC value by the timezone client-side for cases where storing / displaying the original information encoded in Git matters.

Assignee Loading
Time tracking Loading