From d683a0e00cd4734b4fab704baef1ee76205722be Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 27 May 2008 23:33:22 -0700 Subject: Git::cat_blob: allow using an empty blob to fix git-svn breakage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent "git-svn optimization" series introduced Git::cat_blob() subroutine whose interface was broken in that it returned the size of the blob but signalled an error by returning 0. You can never use an empty blob with such an interface. This fixes the interface to return a negative value to signal an error. Reported by Björn Steinbrink. Signed-off-by: Junio C Hamano --- perl/Git.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'perl') diff --git a/perl/Git.pm b/perl/Git.pm index 6ba8ee5c0d..d05b633b64 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; -- cgit v1.2.3