* git svn fetch --localtime produces wrong commit times
@ 2017-08-02 14:36 ` Urs Thuermann
2017-08-02 21:34 ` Urs Thuermann
2017-08-08 18:56 ` [PATCH] git svn fetch: Create correct commit timestamp when using --localtime Urs Thuermann
0 siblings, 2 replies; 7+ messages in thread
From: Urs Thuermann @ 2017-08-02 14:36 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git svn fetch --localtime produces wrong commit times
2017-08-02 14:36 ` git svn fetch --localtime produces wrong commit times Urs Thuermann
@ 2017-08-02 21:34 ` Urs Thuermann
2017-08-08 18:56 ` [PATCH] git svn fetch: Create correct commit timestamp when using --localtime Urs Thuermann
1 sibling, 0 replies; 7+ messages in thread
From: Urs Thuermann @ 2017-08-02 21:34 UTC (permalink / raw)
To: git
Urs Thuermann <urs@isnogud.escape.de> writes:
> 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.
Oops, that should be "could *not* find", of course.
urs
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] git svn fetch: Create correct commit timestamp when using --localtime
@ 2017-08-05 0:12 Urs Thuermann
2017-08-07 22:08 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Urs Thuermann @ 2017-08-05 0:12 UTC (permalink / raw)
To: git
In parse_svn_date() prepend the correct UTC offset to the timestamp
returned. This is the offset in effect at the commit time instead of
the offset in effect at calling time.
Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
---
perl/Git/SVN.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 98518f4..bc4eed3 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -1416,7 +1416,7 @@ sub parse_svn_date {
delete $ENV{TZ};
}
- my $our_TZ = get_tz_offset();
+ my $our_TZ = get_tz_offset($epoch_in_UTC);
# This converts $epoch_in_UTC into our local timezone.
my ($sec, $min, $hour, $mday, $mon, $year,
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] git svn fetch: Create correct commit timestamp when using --localtime
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
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2017-08-07 22:08 UTC (permalink / raw)
To: Eric Wong; +Cc: git, Urs Thuermann
Urs Thuermann <urs@isnogud.escape.de> writes:
> In parse_svn_date() prepend the correct UTC offset to the timestamp
> returned. This is the offset in effect at the commit time instead of
> the offset in effect at calling time.
>
> Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
> ---
> perl/Git/SVN.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks; sounds sensible.
Eric?
>
> diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
> index 98518f4..bc4eed3 100644
> --- a/perl/Git/SVN.pm
> +++ b/perl/Git/SVN.pm
> @@ -1416,7 +1416,7 @@ sub parse_svn_date {
> delete $ENV{TZ};
> }
>
> - my $our_TZ = get_tz_offset();
> + my $our_TZ = get_tz_offset($epoch_in_UTC);
>
> # This converts $epoch_in_UTC into our local timezone.
> my ($sec, $min, $hour, $mday, $mon, $year,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git svn fetch: Create correct commit timestamp when using --localtime
2017-08-07 22:08 ` Junio C Hamano
@ 2017-08-08 2:42 ` Eric Wong
2017-08-08 16:57 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2017-08-08 2:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Urs Thuermann
Junio C Hamano <gitster@pobox.com> wrote:
> Urs Thuermann <urs@isnogud.escape.de> writes:
>
> > In parse_svn_date() prepend the correct UTC offset to the timestamp
> > returned. This is the offset in effect at the commit time instead of
> > the offset in effect at calling time.
> >
> > Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
> > ---
> > perl/Git/SVN.pm | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Thanks; sounds sensible.
>
> Eric?
Yep, seems alright. Can you apply directly?
Been a bit preoccupied as of late. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git svn fetch: Create correct commit timestamp when using --localtime
2017-08-08 2:42 ` Eric Wong
@ 2017-08-08 16:57 ` Junio C Hamano
2017-08-02 14:36 ` git svn fetch --localtime produces wrong commit times Urs Thuermann
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2017-08-08 16:57 UTC (permalink / raw)
To: Eric Wong; +Cc: git, Urs Thuermann
Eric Wong <e@80x24.org> writes:
> Junio C Hamano <gitster@pobox.com> wrote:
>> Urs Thuermann <urs@isnogud.escape.de> writes:
>>
>> > In parse_svn_date() prepend the correct UTC offset to the timestamp
>> > returned. This is the offset in effect at the commit time instead of
>> > the offset in effect at calling time.
>> >
>> > Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
>> > ---
>> > perl/Git/SVN.pm | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> Thanks; sounds sensible.
>>
>> Eric?
>
> Yep, seems alright. Can you apply directly?
> Been a bit preoccupied as of late. Thanks.
Surely, I'll just add your Reviewed-by: myself ;-)
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] git svn fetch: Create correct commit timestamp when using --localtime
2017-08-02 14:36 ` git svn fetch --localtime produces wrong commit times Urs Thuermann
2017-08-02 21:34 ` Urs Thuermann
@ 2017-08-08 18:56 ` Urs Thuermann
1 sibling, 0 replies; 7+ messages in thread
From: Urs Thuermann @ 2017-08-08 18:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Eric Wong, git
Junio C Hamano <gitster@pobox.com> writes:
> > Yep, seems alright. Can you apply directly?
> > Been a bit preoccupied as of late. Thanks.
>
> Surely, I'll just add your Reviewed-by: myself ;-)
OK, thanks. This will fix the bug I've reported here a week or so ago
(see the References header).
urs
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-08-08 19:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` git svn fetch --localtime produces wrong commit times Urs Thuermann
2017-08-02 21:34 ` Urs Thuermann
2017-08-08 18:56 ` [PATCH] git svn fetch: Create correct commit timestamp when using --localtime Urs Thuermann
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).