-# returns the git object_id of $fh, does not write the object to FS
-sub git_hash_raw ($$) {
- my ($self, $raw) = @_;
- # grab the expected OID we have to reindex:
- pipe(my($in, $w)) or die "pipe: $!";
- my $git_dir = $self->git->{git_dir};
- my $cmd = ['git', "--git-dir=$git_dir", qw(hash-object --stdin)];
- my $r = popen_rd($cmd, undef, { 0 => $in });
- print $w $$raw or die "print \$w: $!";
- close $w or die "close \$w: $!";
- local $/ = "\n";
- chomp(my $oid = <$r>);
- close $r or die "git hash-object failed: $?";
- $oid =~ /\A$OID\z/ or die "OID not expected: $oid";
- $oid;
-}
-