threads / patch / 16957

patchGit.pm: let a false Directory parameter (such as 0) be used correctly by the constructor

Subject: [PATCH] Git.pm: let a false Directory parameter (such as 0) be used correctly by the constructor

## tl;dr

2 messages between Jan 2, 2009 and Jan 2, 2009. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Philippe Bruhat (BooK)· Jan 2, 2009, 08:47 UTC · lore
Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
---
 perl/Git.pm |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
Show changes to perl/Git.pm +4 −3
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});
-- 
1.6.0.3.517.g759a
Philippe Bruhat (BooK)· Jan 2, 2009, 09:09 UTC · re: Philippe Bruhat (BooK) · lore

Re: [PATCH] Git.pm: let a false Directory parameter (such as 0) be used correctly by the constructor

On Fri, Jan 02, 2009 at 09:47:37AM +0100, Philippe Bruhat (BooK) wrote:
> Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
> ---
>  perl/Git.pm |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)

Please ignore, I forgot half of the the requested changes. Sorry for the noise.

-- 
 Philippe Bruhat (BooK)

 Mankind is the story of the same mistakes in different places.
                                                 (Moral from Groo #1 (Image))

← back to recent threads