]> git.vpit.fr Git - perl/modules/rgit.git/blobdiff - lib/App/Rgit/Repository.pm
Always canonify the root, the git path and the repo directory
[perl/modules/rgit.git] / lib / App / Rgit / Repository.pm
index f859f8f06aa5e804f6bde023f9359023da92b89a..0ca5e940a692537d136620776cecb421e42461bb 100644 (file)
@@ -3,8 +3,8 @@ package App::Rgit::Repository;
 use strict;
 use warnings;
 
-use Cwd qw/cwd abs_path/;
-use File::Spec::Functions qw/canonpath catdir splitdir abs2rel file_name_is_absolute/;
+use Cwd                   qw/cwd abs_path/;
+use File::Spec::Functions qw/canonpath catdir splitdir abs2rel/;
 use POSIX qw/WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG SIGINT SIGQUIT/;
 
 BEGIN {
@@ -48,9 +48,12 @@ sub new {
  my %args = @_;
 
  my $dir = $args{dir};
- $dir    = abs_path $dir if defined $dir and not file_name_is_absolute $dir;
- $dir    = cwd       unless defined $dir;
- $dir    = canonpath $dir;
+ if (defined $dir) {
+  $dir = abs_path $dir;
+ } else {
+  $dir = cwd;
+ }
+ $dir = canonpath $dir;
 
  my ($repo, $bare, $name, $work);
  if ($args{fake}) {