Skip to content

Commit

Permalink
Git.pm: correctly handle directory name that evaluates to "false"
Browse files Browse the repository at this point in the history
The repository constructor mistakenly rewrote a Directory parameter that
Perl happens to evaluate to false (e.g. "0") to ".".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Philippe Bruhat (BooK) authored and Junio C Hamano committed Jan 1, 2009
1 parent d99bf51 commit 11b8a41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions perl/Git.pm
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,12 @@ sub repository {
}
}

if (not defined $opts{Repository} and not defined $opts{WorkingCopy}) {
$opts{Directory} ||= '.';
if (not defined $opts{Repository} and not defined $opts{WorkingCopy}
and not defined $opts{Directory}) {
$opts{Directory} = '.';
}

if ($opts{Directory}) {
if (defined $opts{Directory}) {
-d $opts{Directory} or throw Error::Simple("Directory not found: $!");

my $search = Git->repository(WorkingCopy => $opts{Directory});
Expand Down

0 comments on commit 11b8a41

Please sign in to comment.