git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BISECTED] git-svn: "Failed to read object ..." during clone

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2008, 06:32 UTC
Message-ID
<7vskw3vsys.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080528030128.GA28904@atjola.homenet>
Björn Steinbrink <B.Steinbrink@gmx.de> writes:
Show 6 quoted lines
> 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;
Previous: Björn SteinbrinkNext: Sam Vilain
Message 2 of 4 in “[BISECTED] git-svn: "Failed to read object ..." during clone”
  1. Björn SteinbrinkMay 28, 2008
  2. Junio C HamanoMay 28, 2008
  3. Sam VilainMay 28, 2008
  4. Björn SteinbrinkMay 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.