git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Urs Thuermann <urs@isnogud.escape.de>
To: git <git@vger.kernel.org>
Subject: git svn fetch --localtime produces wrong commit times
Date: 02 Aug 2017 16:36:25 +0200	[thread overview]
Message-ID: <ygf8tj26npy.fsf@tehran.isnogud.escape.de> (raw)

In converting a SVN repository to git, the commit timestamp is
generated incorrectly.  I use "git svn fetch --localtime" and the
offset from UTC is always set to +0200 (probably because that is the
current local offset here, i.e. Europe/Berlin) even for times when it
should be +0100.

For example, in my SVN working copy I get

    $ svn log -r152
    ------------------------------------------------------------------------
    r152 | urs | 2010-08-16 11:05:52 +0200 (Mon, 16 Aug 2010) | 2 lines

    Add error checks on input file streams

    ------------------------------------------------------------------------
    $ svn log -r158
    ------------------------------------------------------------------------
    r158 | urs | 2010-11-24 00:24:13 +0100 (Wed, 24 Nov 2010) | 16 lines

    Make code portable to Linux/amd64

After converting to git using

    $ mkdir use
    $ cd use
    $ git svn init -s file://$HOME/SVN/use
    Initialized empty Git repository in /home/urs/GIT/use/.git/
    $ git svn fetch -q -A ../ADM/git.svn-authors --localtime
    r1 = 12cb83315be96e594a98b42db7ae57d19e0c7973 (refs/remotes/origin/trunk)
    ...
    r162 = 99ff393f1d64f330b14d6e06412b94fd3023d616 (refs/remotes/origin/trunk)
    Checked out HEAD:
      file:///home/urs/SVN/use/trunk r162

I see wrong commit timestamps:

    $ git log
    ...
    commit c6b4f7aaa66650a16de67d32fb83d541b1973331
    Author: Urs Thuermann <urs@isnogud.escape.de>
    Date:   Wed Nov 24 00:24:13 2010 +0200

        Make code portable to Linux/amd64


        git-svn-id: file:///home/urs/SVN/use/trunk@158 b3714422-7cff-11dd-9a33-b89007e0d947
    ...
    commit a9d95e506681ac5742d2d0927c93f22c541ff170
    Author: Urs Thuermann <urs@isnogud.escape.de>
    Date:   Mon Aug 16 11:05:52 2010 +0200

        Add error checks on input file streams


        git-svn-id: file:///home/urs/SVN/use/trunk@152 b3714422-7cff-11dd-9a33-b89007e0d947
    ...

In revision 152 the timestamp is correct, but for revision 158 the UTC
offset is +0200 instead of +0100.  Then, of course, also the POSIX
timestamp in the commit object is wrong:

    $ git cat-file -p c6b4f7aaa66650a16de67d32fb83d541b1973331
    tree ff4528220ddcf8beca9f4958fbb947d5ed85808e
    parent edcaeb292153663664d850bafe1dad12daab4165
    author Urs Thuermann <urs@isnogud.escape.de> 1290551053 +0200
    committer Urs Thuermann <urs@isnogud.escape.de> 1290551053 +0200

        Make code portable to Linux/amd64
    ...
    $ date -d@1290551053 +%F\ %T\ %z
    2010-11-23 23:24:13 +0100

The correct timestamp would be 2010-11-24 00:24:13 +0100, or, as a
POSIX time_t 1290554653.

I could find the bug grepping through /usr/lib/git-core/git-svn, maybe
it's in GIT::SVN::Fetcher or some other GIT::SVN module.

Is a fix available for this bug?

urs

         reply	other threads:[~2017-08-02 14:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-05  0:12 [PATCH] git svn fetch: Create correct commit timestamp when using --localtime Urs Thuermann
2017-08-07 22:08 ` Junio C Hamano
2017-08-08  2:42   ` Eric Wong
2017-08-08 16:57     ` Junio C Hamano
2017-08-02 14:36       ` Urs Thuermann [this message]
2017-08-02 21:34         ` git svn fetch --localtime produces wrong commit times Urs Thuermann
2017-08-08 18:56         ` [PATCH] git svn fetch: Create correct commit timestamp when using --localtime Urs Thuermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ygf8tj26npy.fsf@tehran.isnogud.escape.de \
    --to=urs@isnogud.escape.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).