Skip to contentSkip to conversation

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

PATCH In review Petr Baudis 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitweb: Make config_to_multi return [] instead of [undef]

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.

---

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index 491a3f4..d5505a4 100755
@@ -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 {
#1 lore raw
Quoted 3 lines · Petr Baudis

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.

gitweb/gitweb.perl sub config_to_int { · line 1516

Quoted 7 lines
gitweb/gitweb.perl +1 -1
@@ -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 ] : [];
Signature · 1 line
Jakub Narebski
#2 lore raw
Quoted 12 lines · Jakub Narebski
Quoted 3 lines · Petr Baudis

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.

Quoted 4 lines
gitweb/gitweb.perl +0 -0
@@ -1512,7 +1512,7 @@ sub config_to_int {
 sub config_to_multi {
 	my $val = shift;
 
Quoted 7 lines

gitweb/gitweb.perl sub config_to_int { · line 1516

Quoted 3 lines
gitweb/gitweb.perl +1 -1
-	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?