diff options
Diffstat (limited to 'perl/Git.pm')
-rw-r--r-- | perl/Git.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/perl/Git.pm b/perl/Git.pm index 058144775..b4ee88bdf 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -511,7 +511,19 @@ are involved. =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); + } +} |