* [PATCH] Git.pm: fix return value of config method
@ 2008-06-01 20:34 Lea Wiemann
0 siblings, 0 replies; only message in thread
From: Lea Wiemann @ 2008-06-01 20:34 UTC (permalink / raw)
To: git; +Cc: Lea Wiemann
If config is called in array context, it is supposed to return all
values set for the given option key. This works for all cases except
if there is no value set at all. In that case, it wrongly returns
(undef) instead of (). This fixes the return statement so that it
returns undef in scalar context but an empty array in array context.
Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
Use the following command to test this:
perl -e 'use Git; $r = Git->repository("."); my @a = $r->config("nonexistent"); print scalar @a;'
This prints 1 before and 0 after applying this patch.
This will also be covered by the Git.pm test suite, which I'm
correctly working on.
perl/Git.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/perl/Git.pm b/perl/Git.pm
index 07b92c7..222fdbf 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -565,7 +565,7 @@ sub config {
my $E = shift;
if ($E->value() == 1) {
# Key not found.
- return undef;
+ return;
} else {
throw $E;
}
--
1.5.5.GIT
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-06-01 20:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-01 20:34 [PATCH] Git.pm: fix return value of config method Lea Wiemann
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).