From 3377b0c87167d6a8a4df5c8fa05be030e9b5caa4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 24 Dec 2015 11:36:33 +0000 Subject: git: expand callback to support object ID and type This metadata can be useful on an optional basis; allowing calls to $git->check to be skipped. --- lib/PublicInbox/Git.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/Git.pm') diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 0f92dd9a..4bc879ff 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -43,10 +43,10 @@ sub cat_file { my $in = $self->{in}; my $head = $in->getline; $head =~ / missing$/ and return undef; - $head =~ /^[0-9a-f]{40} \S+ (\d+)$/ or + $head =~ /^([0-9a-f]{40}) (\S+) (\d+)$/ or fail($self, "Unexpected result from git cat-file: $head"); - my $size = $1; + my ($hex, $type, $size) = ($1, $2, $3); my $ref_type = $ref ? ref($ref) : ''; my $rv; @@ -55,7 +55,7 @@ sub cat_file { my $cb_err; if ($ref_type eq 'CODE') { - $rv = eval { $ref->($in, \$left) }; + $rv = eval { $ref->($in, \$left, $type, $hex) }; $cb_err = $@; # drain the rest my $max = 8192; -- cgit v1.2.3-24-ge0c7