All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Zwell <dzwell@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] Git.pm: Don't return 'undef' in vector context.
Date: Fri, 16 Nov 2007 00:15:47 -0600	[thread overview]
Message-ID: <473D3593.9080806@zwell.net> (raw)

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

             reply	other threads:[~2007-11-16  6:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-16  6:15 Dan Zwell [this message]
2007-11-16  6:39 ` [PATCH] Git.pm: Don't return 'undef' in vector context 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=473D3593.9080806@zwell.net \
    --to=dzwell@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.