git-svn error: Unable to parse date

6 messages, 4 authors, 2016-06-15 · open the first message on its own page

git-svn error: Unable to parse date

From: Ward Wouts <hidden>
Date: 2016-06-15 22:46:13

Hello,

I got the following error message while trying to fetch a subversion
repository:

$ git svn init file:///home/mg/svn/mg git-svn-test
Initialized empty Git repository in /home/ward/worktrees/git-svn-test/.git/
$ cd git-svn-test
$ git svn fetch

r59 = c20f5b6c61bb8b2babc1b3644b6372e023d9d428 (git-svn)
W: +empty_dir: CFE
r60 = 1b8ad7c39dd60897319545c9f3f08b3b2b82b863 (git-svn)
        A       CFE/Makefile
Unable to parse date: 2004-03-09T09:44:33.Z
 at /usr/bin/git-svn line 3995


The message goes away with this one character patch:

$ diff -bru git-svn*
--- git-svn     2009-02-17 10:23:24.000000000 +0100
+++ git-svn.orig        2009-02-17 10:20:30.000000000 +0100
@@ -2387,7 +2387,7 @@
 sub parse_svn_date {
        my $date = shift || return '+0000 1970-01-01 00:00:00';
        my ($Y,$m,$d,$H,$M,$S) = ($date =~ /^(\d{4})\-(\d\d)\-(\d\d)T
-                                           (\d\d)\:(\d\d)\:(\d\d).\d*Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
                                         croak "Unable to parse date: $date\n";
        "+0000 $Y-$m-$d $H:$M:$S";
 }


As the matching digits get ignored I don't see how this patch could introduce a
problem. Then again, I'm just starting with git and don't know anything about
the internals of either git or subversion.

Ward

Re: git-svn error: Unable to parse date

From: Deskin Miller <hidden>
Date: 2016-06-15 22:46:13

Hi,

Cc:ing Eric Wong, the git-svn author; further comments inline.

On Tue, Feb 17, 2009 at 04:48, Ward Wouts [off-list ref] wrote:
$ git svn fetch
Unable to parse date: 2004-03-09T09:44:33.Z
 at /usr/bin/git-svn line 3995

The message goes away with this one character patch:

$ diff -bru git-svn*
Not using git to hack on git?
quoted hunk
--- git-svn     2009-02-17 10:23:24.000000000 +0100
+++ git-svn.orig        2009-02-17 10:20:30.000000000 +0100
@@ -2387,7 +2387,7 @@
 sub parse_svn_date {
       my $date = shift || return '+0000 1970-01-01 00:00:00';
       my ($Y,$m,$d,$H,$M,$S) = ($date =~ /^(\d{4})\-(\d\d)\-(\d\d)T
-                                           (\d\d)\:(\d\d)\:(\d\d).\d*Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
                                        croak "Unable to parse date: $date\n";
       "+0000 $Y-$m-$d $H:$M:$S";
 }
I was rather confused until I looked at the source currently in git,
but it looks like you have the patch lines backward.  Looking at the
diff header now that's more clear to me.  At any rate, it's clear why
this date didn't parse, and why your patch fixes it.

I don't have any idea what sort of date format git should be expecting
from svn, so the possibility exists that the current regex is actually
correct and svn is buggily leaving off the subseconds.  Especially
given that this timestamp issue doesn't seem to have come up before,
that feels like a very real possibility.  All the same, even if it is
svn's fault, we likely want to adjust to accommodate faulty svn
installs, certainly in easy cases like this; but I'll defer to Eric in
that regard.

I appreciate the time you took to address this issue, and go so far as
to submit a patch, but you'll be much farther ahead if you use git to
submit patches to git.  Your patch is pretty small and easy to
understand, but it's still lacking a commit message and a signoff from
you, and the diff is actually backwards.  Patches in this state often
end up dropped on the floor on this list- there's too much work to be
done to spend our time on stuff where people haven't used the list
conventions.  It'd be a shame for any further work you do improving
git go to waste, especially when it's not hard to correct, so I'm
trying to help out now by pointing you in the right direction.  You
can find git.git on the web at the following address, along with git
URLs from which you can clone:

http://git.kernel.org/?p=git/git.git;a=summary

Within the repository, Documentation/SubmittingPatches is your best
guide to sending stuff to the mailing list.

In anticipation of a proper commit message and the like, this patch is

Acked-by: Deskin Miller <redacted>

Re: git-svn error: Unable to parse date

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:13

Ward Wouts [off-list ref] writes:
Unable to parse date: 2004-03-09T09:44:33.Z
 at /usr/bin/git-svn line 3995
A very nice problem description, illustrating what the code should accept
but doesn't.
quoted hunk
The message goes away with this one character patch:

$ diff -bru git-svn*
--- git-svn     2009-02-17 10:23:24.000000000 +0100
+++ git-svn.orig        2009-02-17 10:20:30.000000000 +0100
@@ -2387,7 +2387,7 @@
 sub parse_svn_date {
        my $date = shift || return '+0000 1970-01-01 00:00:00';
        my ($Y,$m,$d,$H,$M,$S) = ($date =~ /^(\d{4})\-(\d\d)\-(\d\d)T
-                                           (\d\d)\:(\d\d)\:(\d\d).\d*Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
                                         croak "Unable to parse date: $date\n";
        "+0000 $Y-$m-$d $H:$M:$S";
 }
You had me scratch my head by giving a reverse patch.

I think neither regexp is quite correct, assuming that SVN timestamp is
supposed to always have decimal point after seconds, with optional
fractional part, followed by Z (presumably to mean Zulu).

-                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d)\.\d*Z$/x) or

The decimal point should get quoted.

Re: git-svn error: Unable to parse date

From: Ward Wouts <hidden>
Date: 2016-06-15 22:46:13

On Tue, Feb 17, 2009 at 10:38:32AM -0800, Junio C Hamano wrote:
Ward Wouts [off-list ref] writes:
quoted
Unable to parse date: 2004-03-09T09:44:33.Z
 at /usr/bin/git-svn line 3995
A very nice problem description, illustrating what the code should accept
but doesn't.
Thank you.
quoted
The message goes away with this one character patch:

$ diff -bru git-svn*
--- git-svn     2009-02-17 10:23:24.000000000 +0100
+++ git-svn.orig        2009-02-17 10:20:30.000000000 +0100
@@ -2387,7 +2387,7 @@
 sub parse_svn_date {
        my $date = shift || return '+0000 1970-01-01 00:00:00';
        my ($Y,$m,$d,$H,$M,$S) = ($date =~ /^(\d{4})\-(\d\d)\-(\d\d)T
-                                           (\d\d)\:(\d\d)\:(\d\d).\d*Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
                                         croak "Unable to parse date: $date\n";
        "+0000 $Y-$m-$d $H:$M:$S";
 }
You had me scratch my head by giving a reverse patch.
Yes, I'm sorry about that. Hopefully my other post about this subject,
sent after the remarks Deskin made, is in the proper format.
I think neither regexp is quite correct, assuming that SVN timestamp is
supposed to always have decimal point after seconds, with optional
fractional part, followed by Z (presumably to mean Zulu).

-                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d)\.\d*Z$/x) or

The decimal point should get quoted.
I think you're right.

Ward

Re: git-svn error: Unable to parse date

From: Eric Wong <hidden>
Date: 2016-06-15 22:46:13

Ward Wouts [off-list ref] wrote:
On Tue, Feb 17, 2009 at 10:38:32AM -0800, Junio C Hamano wrote:
quoted
Ward Wouts [off-list ref] writes:
quoted
Unable to parse date: 2004-03-09T09:44:33.Z
 at /usr/bin/git-svn line 3995
A very nice problem description, illustrating what the code should accept
but doesn't.
Thank you.
quoted
quoted
The message goes away with this one character patch:

$ diff -bru git-svn*
--- git-svn     2009-02-17 10:23:24.000000000 +0100
+++ git-svn.orig        2009-02-17 10:20:30.000000000 +0100
@@ -2387,7 +2387,7 @@
 sub parse_svn_date {
        my $date = shift || return '+0000 1970-01-01 00:00:00';
        my ($Y,$m,$d,$H,$M,$S) = ($date =~ /^(\d{4})\-(\d\d)\-(\d\d)T
-                                           (\d\d)\:(\d\d)\:(\d\d).\d*Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
                                         croak "Unable to parse date: $date\n";
        "+0000 $Y-$m-$d $H:$M:$S";
 }
You had me scratch my head by giving a reverse patch.
Yes, I'm sorry about that. Hopefully my other post about this subject,
sent after the remarks Deskin made, is in the proper format.
quoted
I think neither regexp is quite correct, assuming that SVN timestamp is
supposed to always have decimal point after seconds, with optional
fractional part, followed by Z (presumably to mean Zulu).

-                                           (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
+                                           (\d\d)\:(\d\d)\:(\d\d)\.\d*Z$/x) or

The decimal point should get quoted.
I think you're right.
Yup.  Consider a patch with the quoted decimal point to be
  Acked-by: Eric Wong [off-list ref]

Thanks Junio, Deskin and Ward.


Ward: Just curious, which version of the SVN libraries are you running?

Odd that this hasn't come up before, I wonder if it's the latest
versions (which I haven't tried, still on 1.5.1) or if SVN just
truncates the zeroes...

-- 
Eric Wong

Re: git-svn error: Unable to parse date

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:14

Eric Wong [off-list ref] writes:
Yup.  Consider a patch with the quoted decimal point to be
  Acked-by: Eric Wong [off-list ref]
Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help