Git.pm: Don't #define around die
[gitweb.git] / perl / Git.pm
index 5ec7ef8c246bdcfab725490ce383fee083ff8f82..b4ee88bdfdc9fd6050b3898d0dcb6040a68ae967 100644 (file)
@@ -178,7 +178,8 @@ sub repository {
                };
 
                if ($dir) {
-                       $opts{Repository} = abs_path($dir);
+                       $dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
+                       $opts{Repository} = $dir;
 
                        # If --git-dir went ok, this shouldn't die either.
                        my $prefix = $search->command_oneline('rev-parse', '--show-prefix');
@@ -510,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);
+       }
+}