threads / patch / 11196

patchgitweb: Make config_to_multi return [] instead of [undef]

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

## tl;dr

3 messages between Dec 8, 2007 and Dec 9, 2007. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Petr Baudis· Dec 8, 2007, 12:30 UTC · lore

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(-)
Show changes to gitweb/gitweb.perl +1 −1
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· Dec 8, 2007, 16:13 UTC · re: Petr Baudis · lore

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

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.
 
Show 7 quoted lines
> @@ -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· Dec 9, 2007, 08:29 UTC · re: Jakub Narebski · lore

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

Jakub Narebski <jnareb@gmail.com> writes:
Show 19 quoted lines
> 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?

← back to recent threads