Skip to content

Fix Web GUI operations timezone

Baodong requested to merge icbd/gitaly:fix/operations_lose_timezone into master

Why do we need this MR

Example Repo on GitHub with current timezone

git log is as follows:

  • @CbdFocus <wwwicbd@gmail.com> corresponds to operations on the GitHub Web GUI
  • Baodong <wwwicbd@gmail.com> corresponds to operations on the local git terminal
commit 00a2689d4db87650dc8810fe13598f1b21bbb11d (HEAD -> main, origin/main, origin/HEAD)
Merge: 1483317 a6732fe
Author: @CbdFocus <wwwicbd@gmail.com>
Date:   Sat Jun 12 09:25:47 2021 +0800

    Merge pull request #1 from icbd/feat1

    Create desc.md

commit a6732feae480145d9e9b15dbbe010974c76e3e3a (origin/feat1, feat1)
Author: Baodong <wwwicbd@gmail.com>
Date:   Sat Jun 12 09:24:22 2021 +0800

    From terminal

commit 4ac6cc753643ff187cd260446e45732af9b03d86
Author: @CbdFocus <wwwicbd@gmail.com>
Date:   Sat Jun 12 09:22:24 2021 +0800

    From Web

commit 2f000f8418c499616608991e25e52859b35a6b66
Author: @CbdFocus <wwwicbd@gmail.com>
Date:   Sat Jun 12 09:18:53 2021 +0800

    Create desc.md

commit 14833177f76651650b7f569b02777eff6b1d66c2
Author: @CbdFocus <wwwicbd@gmail.com>
Date:   Sat Jun 12 09:17:46 2021 +0800

    Initial commit

As shown above, the time zone of the log is correct.

git log uses the default configuration(without --date=local).

Example Repo on GitLab SaaS without current timezone

GitLab Enterprise Edition 14.0.0-pre 9b1c6698078

git log is as follows:

  • Baodong Cao <wwwicbd@gmail.com> corresponds to operations on the GitLab Web GUI
  • Baodong <wwwicbd@gmail.com> corresponds to operations on the local git terminal
commit 7285164ed932c18ef5db17cebe5b421dfde01576 (HEAD -> main, origin/main, origin/HEAD)
Merge: d8aeefd 618ffba
Author: Baodong Cao <wwwicbd@gmail.com>
Date:   Thu Jun 10 11:00:58 2021 +0000

    Merge branch 'feat' into 'main'

    feat

    See merge request icbd/commit-time-zone!1

commit 618ffba205b6da654946102e2456bcad1be884b3 (origin/feat)
Author: Baodong <wwwicbd@gmail.com>
Date:   Thu Jun 10 19:00:25 2021 +0800

    feat

commit d8aeefda4335759b0206b90272fd4971746cec6f
Author: Baodong <wwwicbd@gmail.com>
Date:   Thu Jun 10 18:58:53 2021 +0800

    Hello

commit fbb2ca08f3767f8439727cf9c50176a8ae2e1478
Author: Baodong Cao <wwwicbd@gmail.com>
Date:   Thu Jun 10 10:57:40 2021 +0000

    Initial commit

As shown above, the time zone from GitLab Web GUI is incorrect.

What did I do

  1. Add timezone to User of shared.proto
  2. Update gRPC client codes by make proto
  3. Change GitLab Gemfile temporarily: gem 'gitaly', path: "/Users/cbd/codes/gitlab-icbd/icbd-gdk/gitaly/"
  4. Add timezone attr to lib/gitlab/git/user.rb of Rails Repo
  5. Add timezone support to Gitaly operations
Edited by Baodong

Merge request reports