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 <gitster@pobox.com>
Philippe Bruhat (BooK) committed
Dec 29, 2008 at 01:25 UTC
11b8a41c4569e99a57137cb2db4b642b57171797
1 file changed
+4
-3
perl/Git.pm
+4
-3
@@ -166,11 +166,12 @@ sub repository {
166
}
167
}
168
169
- if (not defined $opts{Repository} and not defined $opts{WorkingCopy}) {
170
- $opts{Directory} ||= '.';
169
+ if (not defined $opts{Repository} and not defined $opts{WorkingCopy}
170
+ and not defined $opts{Directory}) {
171
+ $opts{Directory} = '.';
172
}
173
173
- if ($opts{Directory}) {
174
+ if (defined $opts{Directory}) {
175
-d $opts{Directory} or throw Error::Simple("Directory not found: $!");
176
177
my $search = Git->repository(WorkingCopy => $opts{Directory});