# [PATCH] gitweb: Make config_to_multi return [] instead of [undef]

3 messages from 2007-12-08 to 2007-12-09. Participants: Petr Baudis, Jakub Narebski, Junio C Hamano.
Thread: https://gitlist.dev/t/11196

## Petr Baudis, 2007-12-08 12:30

Subject: [PATCH] gitweb: Make config_to_multi return [] instead of [undef]
Message-ID: <20071208123058.7364.25491.stgit@rover>
URL: https://gitlist.dev/e/20071208123058.7364.25491.stgit%40rover

```
This is important for the list of clone urls, where if there are
no per-repository clone URL configured, the default base URLs
are never used for URL construction with this patch.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 491a3f4..d5505a4 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1512,7 +1512,7 @@ sub config_to_int {
 sub config_to_multi {
 	my $val = shift;
 
-	return ref($val) ? $val : [ $val ];
+	return ref($val) ? $val : $val ? [ $val ] : [];
 }
 
 sub git_get_project_config {

```

## Jakub Narebski, 2007-12-08 16:13

Subject: Re: [PATCH] gitweb: Make config_to_multi return [] instead of [undef]
Message-ID: <m38x45tb9y.fsf@roke.D-201>
URL: https://gitlist.dev/e/m38x45tb9y.fsf%40roke.D-201
In-Reply-To: <20071208123058.7364.25491.stgit@rover>

```
Petr Baudis <pasky@suse.cz> writes:

> This is important for the list of clone urls, where if there are
> no per-repository clone URL configured, the default base URLs
> are never used for URL construction with this patch.

Thanks.
 
> @@ -1512,7 +1512,7 @@ sub config_to_int {
>  sub config_to_multi {
>  	my $val = shift;
>  
> -	return ref($val) ? $val : [ $val ];
> +	return ref($val) ? $val : $val ? [ $val ] : [];
>  }

Shouldn't it be

  +	return ref($val) ? $val : defined($val) ? [ $val ] : [];

-- 
Jakub Narebski

```

## Junio C Hamano, 2007-12-09 08:29

Subject: Re: [PATCH] gitweb: Make config_to_multi return [] instead of [undef]
Message-ID: <7vlk84s23i.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vlk84s23i.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <m38x45tb9y.fsf@roke.D-201>

```
Jakub Narebski <jnareb@gmail.com> writes:

> Petr Baudis <pasky@suse.cz> writes:
>
>> This is important for the list of clone urls, where if there are
>> no per-repository clone URL configured, the default base URLs
>> are never used for URL construction with this patch.
>
> Thanks.
>  
>> @@ -1512,7 +1512,7 @@ sub config_to_int {
>>  sub config_to_multi {
>>  	my $val = shift;
>>  
>> -	return ref($val) ? $val : [ $val ];
>> +	return ref($val) ? $val : $val ? [ $val ] : [];
>>  }
>
> Shouldn't it be
>
>   +	return ref($val) ? $val : defined($val) ? [ $val ] : [];

I think so.  Pasky?

```
