← Back to team overview

dulwich team mailing list archive

Re: timezone formatting

 

cgit is capable of generating -0000 as well as +0000 when a commit is
created, as it depends on the OS for getting a timezone string (I'm pretty
sure). But when it's parsed (see e.g. date.c), it's just treated as an
integer. You can also see that git log reports these as +0000:

~/d/iso-codes$ git log 0b866^!
...
Author: Alastair McKinstry <mckinstry@xxxxxxxxxx>
Date:   Sat Jan 20 10:55:18 2007 +0000
...
~/d/iso-codes$ git cat-file -p 0b866
...
author Alastair McKinstry <mckinstry@xxxxxxxxxx> 1169290518 -0000
...

So, I think it's safe to handle this only in the commit creation code and
not worry about it when parsing commits. (Or are we considering this a bug
in cgit as well? In that case, the question is probably better directed at
the git mailing list.)

A slightly hacky way to handle both +0000 and -0000 would be to store the
sign bit as a separate field and take the absolute value of the timezone
int.

On Wed, Apr 7, 2010 at 17:10, Jelmer Vernooij <jelmer@xxxxxxxxx> wrote:

> Apparently there is some ambiguity in the way timezones can be
> formatted, in a way that can not be represented using a simple offset
> integer as we do in Commit.commit_timezone and Commit.author_timezone at
> the moment.
>
> The particular issue that I ran into was the iso-codes repository:
>
> git://git.debian.org/iso-codes/iso-codes.git
>
> Here UTC is represented as -0000, e.g. :
>
> tree c0105a8db0ae1d9a7994bf8f81500853cf59eba8
> author Alastair McKinstry <mckinstry@xxxxxxxxxx> 1077476286 -0000
> committer Alastair McKinstry <mckinstry@xxxxxxxxxx> 1077476286 -0000
>
> Initial revision
>
> But if I attempt to create new revisions locally in UTC I end up with
> +0000 as timezone.
>
> I'm considering ways to allow the original string to be kept or
> reproduced, but it seems hard to do this and maintain backwards
> compatibility in a sensible manner. Ideas?
>
> Cheers,
>
> Jelmer
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dulwich
> Post to     : dulwich@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dulwich
> More help   : https://help.launchpad.net/ListHelp
>
>

References