From: Philippe Bruhat (BooK) Date: Mon, 29 Dec 2008 00:25:00 +0000 (+0100) Subject: Git.pm: correctly handle directory name that evaluates to "false" X-Git-Tag: v1.6.1.1~5^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=11b8a41c4569e99a57137cb2db4b642b57171797;p=git.git Git.pm: correctly handle directory name that evaluates to "false" 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 --- diff --git a/perl/Git.pm b/perl/Git.pm index 8392a6833..ad0f53044 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -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});