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

3 messages from 2008-12-29 to 2009-01-02. Participants: Philippe Bruhat (BooK), Junio C Hamano.
Thread: https://gitlist.dev/t/16900

## Philippe Bruhat (BooK), 2008-12-29 00:25

Subject: [PATCH] Git.pm: let a "false" Directory parameter (such as "0") be used correctly by the constructor"
Message-ID: <1230510300-7854-1-git-send-email-book@cpan.org>
URL: https://gitlist.dev/e/1230510300-7854-1-git-send-email-book%40cpan.org

```
---
 perl/Git.pm |    7 ++++---
 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});
-- 
1.6.0.3.517.g759a

```

## Junio C Hamano, 2009-01-01 21:00

Subject: Re: [PATCH] Git.pm: let a "false" Directory parameter (such as "0") be used correctly by the constructor"
Message-ID: <7vwsdeivx9.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwsdeivx9.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1230510300-7854-1-git-send-email-book@cpan.org>

```
"Philippe Bruhat (BooK)" <book@cpan.org> writes:

> ---
>  perl/Git.pm |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)

Lacks sign-off and description but otherwise looks good.  Will queue to
'pu' to leave you a chance to re-send.

    commit b29b1ae7442cd7c1c78e38b7d980905944ec31e0
    Author: Philippe Bruhat (BooK) <book@cpan.org>
    Date:   Mon Dec 29 01:25:00 2008 +0100

        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 ".".


Thanks.

```

## Philippe Bruhat (BooK), 2009-01-02 08:37

Subject: Re: [PATCH] Git.pm: let a "false" Directory parameter (such as "0") be used correctly by the constructor"
Message-ID: <20090102083734.GB25518@plop>
URL: https://gitlist.dev/e/20090102083734.GB25518%40plop
In-Reply-To: <7vwsdeivx9.fsf@gitster.siamese.dyndns.org>

```
On Thu, Jan 01, 2009 at 01:00:18PM -0800, Junio C Hamano wrote:
> "Philippe Bruhat (BooK)" <book@cpan.org> writes:
> 
> > ---
> >  perl/Git.pm |    7 ++++---
> >  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> Lacks sign-off and description but otherwise looks good.  Will queue to
> 'pu' to leave you a chance to re-send.

Yeah, I noticed the lack of Sign-off right after sending. I'll re-send.

-- 
 Philippe Bruhat (BooK)

 A reputation is only as good as the truth beneath it, if any.
                                    (Moral from Groo The Wanderer #91 (Epic))

```
