+
+if ('v2') {
+ my $info = $im->{last_object};
+ like($info->[0], qr/\A[a-f0-9]{40}\z/, 'got last object_id');
+ is($mime->as_string, ${$info->[2]}, 'string matches');
+ is($info->[1], length(${$info->[2]}), 'length matches');
+ my @cmd = ('git', "--git-dir=$git->{git_dir}", qw(hash-object --stdin));
+ my $in = tempfile();
+ print $in $mime->as_string or die "write failed: $!";
+ $in->flush or die "flush failed: $!";
+ $in->seek(0, SEEK_SET);
+ my $out = tempfile();
+ my $pid = spawn(\@cmd, {}, { 0 => fileno($in), 1 => fileno($out)});
+ is(waitpid($pid, 0), $pid, 'waitpid succeeds on hash-object');
+ is($?, 0, 'hash-object');
+ $out->seek(0, SEEK_SET);
+ chomp(my $hashed_obj = <$out>);
+ is($hashed_obj, $info->[0], "last object_id matches exp");
+}
+