diff options
author | Philippe Bruhat (BooK) <book@cpan.org> | 2008-12-29 01:25:00 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-01 06:34:58 -0800 |
commit | 11b8a41c4569e99a57137cb2db4b642b57171797 (patch) | |
tree | a694a687c88e0107ae3d17c1c9069d5c7a5a7cca /perl | |
parent | d99bf51add655b749c5c7f94cecb337c7ef8aadb (diff) | |
download | git-11b8a41c4569e99a57137cb2db4b642b57171797.tar.gz git-11b8a41c4569e99a57137cb2db4b642b57171797.tar.xz |
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.pm | 7 |
1 files changed, 4 insertions, 3 deletions
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}); |