Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong timezone on commit #630

Closed
amol9 opened this issue May 20, 2017 · 1 comment · Fixed by #1547
Closed

Wrong timezone on commit #630

amol9 opened this issue May 20, 2017 · 1 comment · Fixed by #1547

Comments

@amol9
Copy link

amol9 commented May 20, 2017

This happens when committing via call to repo.index.commit(message). The timezone value is off by 20 minutes. When I issue 'git log', the following shows:

commit 8767403c5e175b5bf69b4ba1d23e8462c722867e
Author: Amol 
Date:   Sat May 20 18:50:10 2017 +0530

    'Solved.'

commit 88a0953df5dc4036633e9f5a295291084b144064
Author: Amol 
Date:   Sat May 20 17:28:13 2017 +0550

    Solved.

commit 3a0daff1a2655469d412cfd4ab61b00b8da3f63d
Author: Amol 
Date:   Sat May 20 14:42:33 2017 +0530

    Updated readme.

From the bottom, here's how the commits were made:

  1. via 'git commit' on command line
  2. via call to repo.index.commit
  3. via 'git commit' on command line, again, to make sure it wasn't a problem with git configuration

As you can see, when committed through GitPython, value for timezone is off by 20 minutes. It is an issue with code related to the commit operation. To verify, I added files to the repo using repo.index.add and then committed via 'git commit' on the command line, the timezone was right in this case.

I checked timezone reported by:

  1. system ('date +%z'), +0530
  2. python (time.timezone), -19800

Both show the correct timezone, +0530, i.e., India Standard Time.

@Byron
Copy link
Member

Byron commented Jun 10, 2017

Even though I didn't reproduce this issue, it certainly something that wasn't tested properly enough and thus is prone to not work correctly.

I would appreciate any help with this one, such as a test which reproduces the issue, maybe even alongside a fix :).

jcowgill added a commit to jcowgill/GitPython that referenced this issue Jan 24, 2023
The `utctz_to_altz` and `altz_to_utctz_str` functions fail to handle
timezones with UTC offsets that are not a multiple of one
hour. Rewrite them and add some unit tests.

Fixes gitpython-developers#630
@Byron Byron added this to the v3.1.31 - Bugfixes milestone Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants