Skip to content

Commit 11b8a41

Browse files
bookgitster
authored andcommitted
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 <[email protected]>
1 parent d99bf51 commit 11b8a41

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

perl/Git.pm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,12 @@ sub repository {
166166
}
167167
}
168168

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} = '.';
171172
}
172173

173-
if ($opts{Directory}) {
174+
if (defined $opts{Directory}) {
174175
-d $opts{Directory} or throw Error::Simple("Directory not found: $!");
175176

176177
my $search = Git->repository(WorkingCopy => $opts{Directory});

0 commit comments

Comments
 (0)