Skip Menu |

This queue is for tickets about the Config-GitLike CPAN distribution.

Report information
The Basics
Id: 76781
Status: resolved
Priority: 0/
Queue: Config-GitLike

People
Owner: Nobody in particular
Requestors: dwheeler [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Get Filter Ignored for Single Value
Date: Mon, 23 Apr 2012 17:11:54 -0700
To: bug-config-gitlike [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
In Git: Show quoted text
> git config --get-all user.email
david@justatheory.com Show quoted text
> git config --get user.email
david@justatheory.com Show quoted text
> git config --get user.email foo
Notice that I have only one value for user.email, and it is filtered out when I use the regular expression filter in the command. However, Config::GitLike does not work like this: It only filters if there are multiple values: if (ref $v) { my @results; if (defined $args{filter}) { if ($args{filter} =~ s/^!//) { @results = grep { !/$args{filter}/i } @{$v}; } else { @results = grep { m/$args{filter}/i } @{$v}; } } die "Multiple values" unless @results <= 1; $v = $results[0]; } I think it should filter on anything, something like this: $v = [$v] unless ref $v; my @results; if (defined $args{filter}) { if ($args{filter} =~ s/^!//) { @results = grep { !/$args{filter}/i } @{$v}; } else { @results = grep { m/$args{filter}/i } @{$v}; } } die "Multiple values" unless @results <= 1; $v = $results[0]; Thanks, David
This was resolved in baf2fc2, released in 1.09. - Alex