Skip to contentSkip to conversation

git-svn messing with timezones

PATCH In review Tim Stoakes 6 participants 11 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

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

Signature · 1 line
Tim Stoakes
#1 lore raw
Quoted 16 lines · Tim Stoakes

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.

Quoted 8 lines

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).

Signature · 1 line
Eric Wong
#2 lore raw

Eric Wong([email protected])@260208-23:32:

Quoted 3 lines

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

Signature · 1 line
Tim Stoakes
#3 lore raw

Hi,

Quoted 1 line · Tim Stoakes

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
Quoted 1 line

Is it documented anywhere?

AFAICT it waits to be written. By you.

Ciao,
Dscho

#4 lore raw

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

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

---

Quoted 9 lines · Johannes Schindelin

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
Quoted 1 line

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(-)
Documentation/git-svn.txt +4 -0
index 340f1be..e1babf3 100644
@@ -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
Signature · 1 line
1.5.4
#5 lore raw

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

Hi,

Quoted 1 line · Miklos Vajna

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.

Quoted 6 lines
Quoted 4 lines · Johannes Schindelin

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?):

Quoted 7 lines
Quoted 5 lines
      git log --date=local
Quoted 1 line

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.

Quoted 5 lines
Documentation/git-svn.txt +0 -0
index 340f1be..e1babf3 100644

Documentation/git-svn.txt New features: · line 169

Quoted 10 lines
Documentation/git-svn.txt +4 -0
@@ -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

#6 lore raw

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

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

---

Quoted 5 lines · Johannes Schindelin
Quoted 1 line

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.

Quoted 2 lines

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

oops :(

Quoted 9 lines

Review

Quoted 7 lines

++

(quoted diff) +3 -0
+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(-)
Documentation/git-svn.txt +4 -0
index 340f1be..bec9acc 100644
@@ -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'::
Signature · 1 line
1.5.4
#7 lore raw

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

Hi,

Quoted 2 lines · Miklos Vajna

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

Thanks,
Dscho

#10 lore raw
In reply to Tim Stoakes
Quoted 7 lines · Tim Stoakes

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

Signature · 1 line
Seth Falcon | [email protected] | blog: http://userprimary.net/user/
#8 lore raw
In reply to Johannes Schindelin

Johannes Schindelin([email protected])@270208-10:40:

Quoted 5 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

Signature · 1 line
Tim Stoakes
#9 lore raw
Quoted 10 lines · Tim Stoakes

Johannes Schindelin([email protected])@270208-10:40:

Quoted 5 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!

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.