git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Philippe Bruhat (BooK) <book@cpan.org>
Date
Jan 2, 2009, 08:47 UTC
Message-ID
<1230886057-23994-1-git-send-email-book@cpan.org>
Signed-off-by: Philippe Bruhat (BooK) <book@cpan.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
Next: Philippe Bruhat (BooK)
Message 1 of 2 in “Git.pm: let a false Directory parameter (such as 0) be used correctly by the constructor”
  1. Git.pm: let a false Directory parameter (such as 0) be used correctly by the constructorPhilippe Bruhat (BooK), Jan 2, 2009
  2. Philippe Bruhat (BooK)Jan 2, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.