threads / discuss / 12328

git-svn messing with timezones

Subject: git-svn messing with timezones

## tl;dr

11 messages between Feb 26, 2008 and Feb 27, 2008.

replies: 10people: 6as markdown or json

Tim Stoakes· Feb 26, 2008, 12:47 UTC · lore
Hi all,
When I commit to git, the log shows the correct timezone:
  Date:   Tue Feb 26 23:10:24 2008 +1030
However, when I then dcommit this to SVN with git-svn, the timezone gets
mangled. If I now 'git log', the same commit shows
  Date:   Tue Feb 26 12:40:24 2008 +0000

The 'svn log' of that same revision shows the correct timezone: r151 | foo | 2008-02-26 23:10:24 +1030 (Tue, 26 Feb 2008) | 2 lines so, I know it's git-svn doing it, not svn itself.

The same mangling has happened to commits that came through the original git-svn import, and subsequent 'git-svn rebase's.

I've tried things like: $ TZ=Australia/Adelaide git svn dcommit all end in the same result - UTC appears in the logs.

I'm using: git version 1.5.4.3

Can anyone help? Thanks Tim

-- 
Tim Stoakes
Eric Wong· Feb 27, 2008, 07:32 UTC · re: Tim Stoakes · lore

Re: git-svn messing with timezones

Tim Stoakes <tim@stoakes.net> wrote:
Show 24 quoted lines
> Hi all,
> 
> When I commit to git, the log shows the correct timezone:
>   Date:   Tue Feb 26 23:10:24 2008 +1030
> 
> However, when I then dcommit this to SVN with git-svn, the timezone gets
> mangled. If I now 'git log', the same commit shows
>   Date:   Tue Feb 26 12:40:24 2008 +0000
> 
> The 'svn log' of that same revision shows the correct timezone:
> r151 | foo | 2008-02-26 23:10:24 +1030 (Tue, 26 Feb 2008) | 2 lines
> so, I know it's git-svn doing it, not svn itself.
> 
> The same mangling has happened to commits that came through the original
> git-svn import, and subsequent 'git-svn rebase's.
> 
> I've tried things like:
> $ TZ=Australia/Adelaide git svn dcommit
> all end in the same result - UTC appears in the logs.
> 
> I'm using:
> git version 1.5.4.3
> 
> Can anyone help?
Hi Tim,
This is actually the intended behavior of git-svn.

SVN itself only stores times in UTC and nothing else. The SVN repository itself has no timezone information (unless the server it was on is misconfigured :)

The regular svn client converts the UTC time to the local time (or based on the TZ= environment). Using "git svn log" should mimic the timezone behavior of the regular svn client.

git-svn will only import times as UTC because that's what SVN gives it.

As a side effect, this also makes it easier for multiple users to independently create repositories that result in the same commit SHA1s (and one of the reasons for using dcommit over git svn set-tree).

-- 
Eric Wong
Tim Stoakes· Feb 27, 2008, 10:26 UTC · re: Eric Wong · lore

Re: git-svn messing with timezones

Eric Wong(normalperson@yhbt.net)@260208-23:32:
> The regular svn client converts the UTC time to the local time (or
> based on the TZ= environment).  Using "git svn log" should mimic the
> timezone behavior of the regular svn client.
Ah indeed, `git-svn log` does show the correct TZ. How annoying!

My workflow is to work with native git as much as possible, and interact with svn as little as is required. This means I have to remember to run one command to see sane logs of git commits that happen to also be svn commits, and another one for the normal git commits. There is no transparency here.

Thanks for clearing that up though Eric. Is it documented anywhere?
Tim
-- 
Tim Stoakes
Johannes Schindelin· Feb 27, 2008, 10:40 UTC · re: Tim Stoakes · lore

Re: git-svn messing with timezones

Hi,
On Wed, 27 Feb 2008, Tim Stoakes wrote:
> Ah indeed, `git-svn log` does show the correct TZ. How annoying!
Note: if all you want is such a strange behaviour as svn's (I mean, why 
does it insist to show the dates as if they were done in _your_ 
timezone?):
	git log --date=local
> Is it documented anywhere?
AFAICT it waits to be written.  By you.

Ciao, Dscho

Miklos Vajna· Feb 27, 2008, 12:29 UTC · re: Johannes Schindelin · lore

[PATCH] Documentation/git svn log: add a note about timezones.

git svn log mimics the timezone converting behaviour of svn log, but this was undocumented.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Wed, Feb 27, 2008 at 10:40:37AM +0000, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 9 quoted lines
> Note: if all you want is such a strange behaviour as svn's (I mean, why
> does it insist to show the dates as if they were done in _your_
> timezone?):
>
>       git log --date=local
>
> > Is it documented anywhere?
>
> AFAICT it waits to be written.  By you.
something like this?
 Documentation/git-svn.txt |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 340f1be..e1babf3 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -160,6 +160,10 @@ New features:
 --
 +
 Any other arguments are passed directly to `git log'
++
+NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
+client converts the UTC time to the local time (or based on the TZ=
+environment). This command has the same behaviour.
 
 'blame'::
        Show what revision and author last modified each line of a file. This is
-- 
1.5.4
Johannes Schindelin· Feb 27, 2008, 12:33 UTC · re: Miklos Vajna · lore

Re: [PATCH] Documentation/git svn log: add a note about timezones.

Hi,
On Wed, 27 Feb 2008, Miklos Vajna wrote:
> git svn log mimics the timezone converting behaviour of svn log, but this was

This line is definitely too long. Please make commit messages readable on an 80-character display with a 4-character indent, i.e. 76 characters/line.

Show 13 quoted lines
> On Wed, Feb 27, 2008 at 10:40:37AM +0000, Johannes Schindelin 
> <Johannes.Schindelin@gmx.de> wrote:
> > Note: if all you want is such a strange behaviour as svn's (I mean, 
> > why does it insist to show the dates as if they were done in _your_ 
> > timezone?):
> >
> >       git log --date=local
> >
> > > Is it documented anywhere?
> >
> > AFAICT it waits to be written.  By you.
> 
> something like this?

Yes, very nice. Although I find it sad that an opportunity was lost for a complainer to make good.

Show 15 quoted lines
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 340f1be..e1babf3 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -160,6 +160,10 @@ New features:
>  --
>  +
>  Any other arguments are passed directly to `git log'
> ++
> +NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
> +client converts the UTC time to the local time (or based on the TZ=
> +environment). This command has the same behaviour.
>  
>  'blame'::
>         Show what revision and author last modified each line of a file. This is
I think that this note should come before the "Any other arguments" line.

Ciao, Dscho

Miklos Vajna· Feb 27, 2008, 13:13 UTC · re: Johannes Schindelin · lore

[PATCH] Documentation/git svn log: add a note about timezones.

git svn log mimics the timezone converting behaviour of svn log, but this was undocumented.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Wed, Feb 27, 2008 at 12:33:22PM +0000, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 5 quoted lines
> > git svn log mimics the timezone converting behaviour of svn log, but this was
>
> This line is definitely too long.  Please make commit messages readable on
> an 80-character display with a 4-character indent, i.e. 76
> characters/line.
right, corrected.
> Yes, very nice.  Although I find it sad that an opportunity was lost for a
> complainer to make good.
oops :(
Show 9 quoted lines
> > ++
> > +NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
> > +client converts the UTC time to the local time (or based on the TZ=
> > +environment). This command has the same behaviour.
> >
> >  'blame'::
> >         Show what revision and author last modified each line of a file. This is
>
> I think that this note should come before the "Any other arguments" line.
moved.
 Documentation/git-svn.txt |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 340f1be..bec9acc 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -159,6 +159,10 @@ New features:
 	our version of --pretty=oneline
 --
 +
+NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
+client converts the UTC time to the local time (or based on the TZ=
+environment). This command has the same behaviour.
++
 Any other arguments are passed directly to `git log'
 
 'blame'::
-- 
1.5.4
Johannes Schindelin· Feb 27, 2008, 13:15 UTC · re: Miklos Vajna · lore

Re: [PATCH] Documentation/git svn log: add a note about timezones.

Hi,
On Wed, 27 Feb 2008, Miklos Vajna wrote:
> git svn log mimics the timezone converting behaviour of svn log, but
> this was undocumented.

Thanks, Dscho

Tim Stoakes· Feb 27, 2008, 23:09 UTC · re: Johannes Schindelin · lore

Re: git-svn messing with timezones

Johannes Schindelin(Johannes.Schindelin@gmx.de)@270208-10:40:
Show 5 quoted lines
> Note: if all you want is such a strange behaviour as svn's (I mean, why 
> does it insist to show the dates as if they were done in _your_ 
> timezone?):
> 
> 	git log --date=local

Ah excellent, that's what I want I think. I'm stuck with SVN for work, and reviewing commits that appeared to happen at 4am does not do much for my sanity!

Thanks all.
Tim
-- 
Tim Stoakes
Junio C Hamano· Feb 27, 2008, 23:23 UTC · re: Tim Stoakes · lore

Re: git-svn messing with timezones

Tim Stoakes <tim@stoakes.net> writes:
Show 10 quoted lines
> Johannes Schindelin(Johannes.Schindelin@gmx.de)@270208-10:40:
>> Note: if all you want is such a strange behaviour as svn's (I mean, why 
>> does it insist to show the dates as if they were done in _your_ 
>> timezone?):
>> 
>> 	git log --date=local
>
> Ah excellent, that's what I want I think. I'm stuck with SVN for work,
> and reviewing commits that appeared to happen at 4am does not do much
> for my sanity!

FYI ("you" not referring to Tim in particular but the list readers in general), the same --date=local can be used in a repository that talk with CVS.

Seth Falcon· Feb 27, 2008, 16:21 UTC · re: Tim Stoakes · lore

Re: git-svn messing with timezones

Tim Stoakes <tim@stoakes.net> writes:
Show 7 quoted lines
> Ah indeed, `git-svn log` does show the correct TZ. How annoying!
>
> My workflow is to work with native git as much as possible, and interact
> with svn as little as is required. This means I have to remember to run
> one command to see sane logs of git commits that happen to also be svn
> commits, and another one for the normal git commits. There is no
> transparency here.
You might find it convenient to set an alias in ~/gitconfig like:
    [alias]
            llog = log --date=local
The you can review commits in your TZ via 'git llog'.
+ seth
-- 
Seth Falcon | seth@userprimary.net | blog: http://userprimary.net/user/

← back to recent threads