path: root/perl
diff options
authorJunio C Hamano <>2008-05-28 06:33:22 (GMT)
committerJunio C Hamano <>2008-05-28 06:35:55 (GMT)
commitd683a0e00cd4734b4fab704baef1ee76205722be (patch)
tree5bd68609cb1d489f83455bda25200d4050415fd7 /perl
parentb2a42f55bc419352b848751b0763b0a2d1198479 (diff)
Git::cat_blob: allow using an empty blob to fix git-svn breakage
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 <>
Diffstat (limited to 'perl')
1 files changed, 2 insertions, 2 deletions
diff --git a/perl/ b/perl/
index 6ba8ee5..d05b633 100644
--- a/perl/
+++ b/perl/
@@ -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;