Git.pm: Avoid ppport.h
[gitweb.git] / perl / Git.pm
index 05814477577d79cfda03b1850402de5c40b8b616..b4ee88bdfdc9fd6050b3898d0dcb6040a68ae967 100644 (file)
@@ -511,7 +511,19 @@ sub wc_chdir {
 
 =cut
 
-# Implemented in Git.xs.
+sub hash_object {
+       my ($self, $type, $file) = _maybe_self(@_);
+
+       # hash_object_* implemented in Git.xs.
+
+       if (ref($file) eq 'GLOB') {
+               my $hash = hash_object_pipe($type, fileno($file));
+               close $file;
+               return $hash;
+       } else {
+               hash_object_file($type, $file);
+       }
+}