git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BISECTED] git-svn: "Failed to read object ..." during clone
@ 2008-05-28  3:01 Björn Steinbrink
  2008-05-28  6:32 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Björn Steinbrink @ 2008-05-28  3:01 UTC (permalink / raw)
  To: Adam Roben; +Cc: git, Eric Wong

Hi Adam,

when cloning the SVN repository at svn://svn.debian.org/estron/ git-svn bails
out with:
Failed to read object e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 at
/usr/local/bin/git-svn line 3195, <GEN36> line 645.

Bisection led to:
ffe256f9bac8a40ff751a9341a5869d98f72c285 is first bad commit
commit ffe256f9bac8a40ff751a9341a5869d98f72c285
Author: Adam Roben <aroben@apple.com>
Date:   Fri May 23 16:19:41 2008 +0200

    git-svn: Speed up fetch
    
    We were spending a lot of time forking/execing git-cat-file and
    git-hash-object. We now maintain a global Git repository object in order to use
    Git.pm's more efficient hash_and_insert_object and cat_blob methods.

I can reliable reproduce the problem using this command:
git svn clone -r215:230 svn://svn.debian.org/estron/trunk

$ git --version
git version 1.5.6.rc0.13.g2d392
$ git svn --version
git-svn version 1.5.6.rc0.13.g2d392 (svn 1.4.6)

Björn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BISECTED] git-svn: "Failed to read object ..." during clone
  2008-05-28  3:01 [BISECTED] git-svn: "Failed to read object ..." during clone Björn Steinbrink
@ 2008-05-28  6:32 ` Junio C Hamano
  2008-05-28  7:28   ` Sam Vilain
  2008-05-28 14:19   ` Björn Steinbrink
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2008-05-28  6:32 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: Adam Roben, git, Eric Wong

Björn Steinbrink <B.Steinbrink@gmx.de> writes:

> Hi Adam,
>
> when cloning the SVN repository at svn://svn.debian.org/estron/ git-svn bails
> out with:
> Failed to read object e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 at
> /usr/local/bin/git-svn line 3195, <GEN36> line 645.

Heh, I should have been more careful.  The series introduces Git::cat_blob
that returns the size of a blob but the interface is broken and signals
error by returning zero.  e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 is a
zero sized blob.

Would this be enough?

---

 git-svn.perl |    4 ++--
 perl/Git.pm  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 37976f2..3a6eb1c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3191,7 +3191,7 @@ sub apply_textdelta {
 	if ($fb->{blob}) {
 		print $base 'link ' if ($fb->{mode_a} == 120000);
 		my $size = $::_repository->cat_blob($fb->{blob}, $base);
-		die "Failed to read object $fb->{blob}" unless $size;
+		die "Failed to read object $fb->{blob}" if ($size < 0);
 
 		if (defined $exp) {
 			seek $base, 0, 0 or croak $!;
@@ -3570,7 +3570,7 @@ sub chg_file {
 		$self->change_file_prop($fbat,'svn:special',undef);
 	}
 	my $size = $::_repository->cat_blob($m->{sha1_b}, $fh);
-	croak "Failed to read object $m->{sha1_b}" unless $size;
+	croak "Failed to read object $m->{sha1_b}" if ($size < 0);
 	$fh->flush == 0 or croak $!;
 	seek $fh, 0, 0 or croak $!;
 
diff --git a/perl/Git.pm b/perl/Git.pm
index 6ba8ee5..d05b633 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -811,12 +811,12 @@ sub cat_blob {
 	my $description = <$in>;
 	if ($description =~ / missing$/) {
 		carp "$sha1 doesn't exist in the repository";
-		return 0;
+		return -1;
 	}
 
 	if ($description !~ /^[0-9a-fA-F]{40} \S+ (\d+)$/) {
 		carp "Unexpected result returned from git cat-file";
-		return 0;
+		return -1;
 	}
 
 	my $size = $1;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [BISECTED] git-svn: "Failed to read object ..." during clone
  2008-05-28  6:32 ` Junio C Hamano
@ 2008-05-28  7:28   ` Sam Vilain
  2008-05-28 14:19   ` Björn Steinbrink
  1 sibling, 0 replies; 4+ messages in thread
From: Sam Vilain @ 2008-05-28  7:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> Heh, I should have been more careful.  The series introduces Git::cat_blob
> that returns the size of a blob but the interface is broken and signals
> error by returning zero.  e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 is a
> zero sized blob.
> 
> Would this be enough?
>  		my $size = $::_repository->cat_blob($fb->{blob}, $base);
> -		die "Failed to read object $fb->{blob}" unless $size;
> +		die "Failed to read object $fb->{blob}" if ($size < 0);

Heh.  This sort of thing is why perl has "undef"; you could make that
"unless defined $size" and "return undef" in the functions.

Sam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BISECTED] git-svn: "Failed to read object ..." during clone
  2008-05-28  6:32 ` Junio C Hamano
  2008-05-28  7:28   ` Sam Vilain
@ 2008-05-28 14:19   ` Björn Steinbrink
  1 sibling, 0 replies; 4+ messages in thread
From: Björn Steinbrink @ 2008-05-28 14:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Adam Roben, git, Eric Wong

On 2008.05.27 23:32:59 -0700, Junio C Hamano wrote:
> Björn Steinbrink <B.Steinbrink@gmx.de> writes:
> 
> > Hi Adam,
> >
> > when cloning the SVN repository at svn://svn.debian.org/estron/ git-svn bails
> > out with:
> > Failed to read object e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 at
> > /usr/local/bin/git-svn line 3195, <GEN36> line 645.
> 
> Heh, I should have been more careful.  The series introduces Git::cat_blob
> that returns the size of a blob but the interface is broken and signals
> error by returning zero.  e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 is a
> zero sized blob.
> 
> Would this be enough?

At least the failing clone command now works and the history for the
previously empty .cvsignore file (which I guess was the one that caused
the failure) looks good. Didn't check anything else on that clone,
because I had just randomly chosen that repository to test something
completely different and then noticed the clone failure.

Thanks,
Björn

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-28 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-28  3:01 [BISECTED] git-svn: "Failed to read object ..." during clone Björn Steinbrink
2008-05-28  6:32 ` Junio C Hamano
2008-05-28  7:28   ` Sam Vilain
2008-05-28 14:19   ` Björn Steinbrink

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 NNTP newsgroup(s).