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 <redacted>
---
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