summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorPhilippe Bruhat (BooK) <book@cpan.org>2008-12-29 01:25:00 +0100
committerJunio C Hamano <gitster@pobox.com>2009-01-01 06:34:58 -0800
commit11b8a41c4569e99a57137cb2db4b642b57171797 (patch)
treea694a687c88e0107ae3d17c1c9069d5c7a5a7cca /perl
parentd99bf51add655b749c5c7f94cecb337c7ef8aadb (diff)
downloadgit-11b8a41c4569e99a57137cb2db4b642b57171797.tar.gz
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>
Diffstat (limited to 'perl')
-rw-r--r--perl/Git.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index 8392a68333..ad0f530445 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});