Git.pm: stop assuming that absolute paths start with a slash
[gitweb.git] / perl / Git.pm
index 19ef081103a56e3c723749dc172ccc356a9b795c..49eb88af8d052e2bd71b83576034f8d338290013 100644 (file)
@@ -188,7 +188,8 @@ sub repository {
                };
 
                if ($dir) {
-                       $dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
+                       _verify_require();
+                       File::Spec->file_name_is_absolute($dir) or $dir = $opts{Directory} . '/' . $dir;
                        $opts{Repository} = abs_path($dir);
 
                        # If --git-dir went ok, this shouldn't die either.