threads / bug / 38827

[BUG] git svn's --localtime seems to corrupt time zones

Subject: [BUG] git svn's --localtime seems to corrupt time zones

## tl;dr

One message between Mar 16, 2015 and Mar 16, 2015.

replies: 0people: 1as markdown or json

Christoph Anton Mitterer· Mar 16, 2015, 17:31 UTC · lore
Hi.

I was converting some very old svn repos of mine into git using git svn, and since I didn't fully trust the conversion process I wrote a small tool which goes through all commits/revisions (there were no branches or non-linear stuff involved in these svn repos) and compares the author names, dates, commit messages and file tree for each revision/commit.

I used something like: git svn clone --trunk=/ --no-metadata --localtime --preserve-empty-dirs --authors-file=~/authors.txt file:///...

and used --localtime since I wanted the times/dates with the original time zones (just as it seems to happen with a normal git repo as well).

The svn repo contained commits with different time zones (mostly because of daylight saving times).

With the diff tool I've noticed the following behaviour: Apparently, whenever --localtime is given, git svn takes SVN's time as is, completely ignoring it's time zone, storing *everything* in the current(!) local time zone.

This has IMHO two bugs:
1) it doesn't do what one expects and what the manpage promises:
> --localtime
> Store Git commit times in the local time zone instead of UTC.
> This makes git log (even without --date=local) show the same
> times that svn log would in the local time zone.

=> This isn't true, cause while svn log shows the differing time zones (in my case +0100 and +0200 when the DST changes), git log shows everything in +0100.

2) but even worse, as said above, it seems to ignore the time zones from
SVN, so when I'm currently in +0100, all the svn times from +0100 will
be correct, but all the ones that were stored in +0200 (or anything
else) will have exactly the same time value just the zone changed to
+0100, thereby corrupting the time.

Example svn log output: $ svn log | grep ^r | head -n 4 r781 | calestyo | 2008-08-12 23:26:12 +0200 (Tue, 12 Aug 2008) | 2 lines r780 | calestyo | 2008-01-11 01:16:59 +0100 (Fri, 11 Jan 2008) | 2 lines r779 | calestyo | 2008-01-06 19:43:08 +0100 (Sun, 06 Jan 2008) | 2 lines r778 | calestyo | 2008-01-06 18:51:37 +0100 (Sun, 06 Jan 2008) | 2 lines

And from the corresponding "converted" git repo:
$ git log --date=iso8601 | grep ^Date: | head -n 4
Date:   2008-08-12 23:26:12 +0100
Date:   2008-01-11 01:16:59 +0100
Date:   2008-01-06 19:43:08 +0100
Date:   2008-01-06 18:51:37 +0100
All packages from Debian sid, i.e. git 2.1.4 and subversion 1.8.10.
Any ideas?

Cheers, Chris.

← back to recent threads