git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Git.pm: Don't return 'undef' in vector context.
@ 2007-11-16  6:15 Dan Zwell
  2007-11-16  6:39 ` Junio C Hamano
  2007-11-16  8:43 ` Jakub Narebski
  0 siblings, 2 replies; 8+ messages in thread
From: Dan Zwell @ 2007-11-16  6:15 UTC (permalink / raw)
  To: Git Mailing List

Previously, the Git->repository()->config('non-existent.key')
evaluated to as true in a vector context. Return an empty list
instead.
---
I don't know whether this breaks anything, because I don't use most of 
the git perl scripts. I can't imagine that there is a script that relies 
on the fact that config('non-existent.key') actually returns (''), in an 
array context. Is this a reasonable change?

  perl/Git.pm |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index e9dc706..ffcc541 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -508,7 +508,7 @@ sub config {
  		my $E = shift;
  		if ($E->value() == 1) {
  			# Key not found.
-			return undef;
+			return wantarray ? () : undef;
  		} else {
  			throw $E;
  		}
-- 
1.5.3.5.565.gf0b83-dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-11-17 15:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-16  6:15 [PATCH] Git.pm: Don't return 'undef' in vector context Dan Zwell
2007-11-16  6:39 ` Junio C Hamano
2007-11-16  8:00   ` Dan Zwell
2007-11-17  0:39     ` Junio C Hamano
2007-11-16 12:47   ` Sebastian Harl
2007-11-16  8:43 ` Jakub Narebski
2007-11-17  3:20   ` Dan Zwell
2007-11-17 15:19     ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).