From: Vincent Pit Date: Mon, 6 Oct 2008 14:05:22 +0000 (+0200) Subject: chdir to the working directory if possible, as commands like pull want it X-Git-Tag: v0.03~12 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=2d737d5df0b318de7cdc2d4c7c225d76f4890038;p=perl%2Fmodules%2Frgit.git chdir to the working directory if possible, as commands like pull want it --- diff --git a/lib/App/Rgit/Repository.pm b/lib/App/Rgit/Repository.pm index 5ef1553..1b88f5c 100644 --- a/lib/App/Rgit/Repository.pm +++ b/lib/App/Rgit/Repository.pm @@ -44,7 +44,7 @@ sub new { $dir = cwd unless defined $dir; my ($repo, $bare, $name, $work); if ($args{fake}) { - $repo = $dir; + $work = $dir; } else { my @tries = ($dir); push @tries, "$dir.git" unless $dir =~ /\.git$/; @@ -85,9 +85,9 @@ C into the repository's directory. sub chdir { my $self = shift; - my $repo = $self->repo; - chdir $repo or do { - warn "Couldn't chdir into $repo: $!"; + my $dir = $self->work; + chdir $dir or do { + warn "Couldn't chdir into $dir: $!"; return; }; return 1;