summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorPhilippe Bruhat (BooK) <book@cpan.org>2008-12-29 00:25:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-01 14:34:58 (GMT)
commit11b8a41c4569e99a57137cb2db4b642b57171797 (patch)
treea694a687c88e0107ae3d17c1c9069d5c7a5a7cca /perl
parentd99bf51add655b749c5c7f94cecb337c7ef8aadb (diff)
downloadgit-11b8a41c4569e99a57137cb2db4b642b57171797.zip
git-11b8a41c4569e99a57137cb2db4b642b57171797.tar.gz
git-11b8a41c4569e99a57137cb2db4b642b57171797.tar.bz2
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 8392a68..ad0f530 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});