]> arthur.barton.de Git - bup.git/commitdiff
git: create_commit_blob: allow timezones to be specified as 0
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 19 Jan 2020 20:18:35 +0000 (21:18 +0100)
committerRob Browning <rlb@defaultvalue.org>
Mon, 11 May 2020 02:01:33 +0000 (21:01 -0500)
Checking "if adate_tz" means that if it's 0 (UTC) then we'll
actually use localtime, which is wrong. Do this only when it's
specified as None.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
(cherry picked from commit 4443772e4a6cbce5479554e881830c500d27b17c)

lib/bup/git.py

index 40bfc0a46731b4c0b4d9a5c299ccca9ddae5477f..08da5caa323593869e2f87077e8379d0ff040e0b 100644 (file)
@@ -779,11 +779,11 @@ class PackWriter:
                    msg):
         """Create a commit object in the pack.  The date_sec values must be
         epoch-seconds, and if a tz is None, the local timezone is assumed."""
-        if adate_tz:
+        if adate_tz is not None:
             adate_str = _git_date_str(adate_sec, adate_tz)
         else:
             adate_str = _local_git_date_str(adate_sec)
-        if cdate_tz:
+        if cdate_tz is not None:
             cdate_str = _git_date_str(cdate_sec, cdate_tz)
         else:
             cdate_str = _local_git_date_str(cdate_sec)