X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Frgit.git;a=blobdiff_plain;f=lib%2FApp%2FRgit%2FRepository.pm;h=c282ebde52d6ce6113daf5896749f5c59ca9c138;hp=83241a15d941d0c9fb3d13ca1a38b8c2ecc321ea;hb=d9762c0e9806aa955f290f36740496f0013747fd;hpb=8fdce8c3a7141c295beda7a77939df531cb8abcc diff --git a/lib/App/Rgit/Repository.pm b/lib/App/Rgit/Repository.pm index 83241a1..c282ebd 100644 --- a/lib/App/Rgit/Repository.pm +++ b/lib/App/Rgit/Repository.pm @@ -47,8 +47,10 @@ sub new { $work = $dir; } else { my @tries = ($dir); - push @tries, "$dir.git" unless $dir =~ /\.git$/; - push @tries, catdir($dir, '.git') unless $dir eq '.git'; + my @chunks = splitdir $dir; + my $last = pop @chunks; + push @tries, "$dir.git" unless $last =~ /\.git$/; + push @tries, catdir($dir, '.git') unless $last eq '.git'; for (@tries) { if (-d $_ && -d "$_/refs" and -d "$_/objects" and -e "$_/HEAD") { $repo = $_; @@ -56,12 +58,12 @@ sub new { } } return unless defined $repo; - my @chunks = splitdir($repo); - my $last = pop @chunks; + @chunks = splitdir $repo; + $last = pop @chunks; if ($last eq '.git') { $bare = 0; $name = $chunks[-1]; - $work = catdir(@chunks); + $work = catdir @chunks; } else { $bare = 1; ($name) = $last =~ /(.*)\.git$/;