]> 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 01:59:41 +0000 (20:59 -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>
lib/bup/git.py

index dd78aa459d9fec43378755b8659e6773aba029fd..8777a58df06afd612ef9574327cc4a54c3e805b6 100644 (file)
@@ -810,11 +810,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)