git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: suppress 'Use of uninitialized value' error
@ 2009-07-30 21:15 Giuseppe Bilotta
  2009-07-30 23:00 ` Jakub Narebski
  0 siblings, 1 reply; 9+ messages in thread
From: Giuseppe Bilotta @ 2009-07-30 21:15 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Junio C Hamano, Petr Baudis, Giuseppe Bilotta

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitweb/gitweb.perl |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

The patch could have been a one-liner by adding the defined check at
line 943, but that pushed the line to 120 char, so I decided for this
slightly more complex form.

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7fbd5ff..c7f257e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -940,10 +940,13 @@ sub href {
 			if (defined $params{'hash_parent_base'}) {
 				$href .= esc_url($params{'hash_parent_base'});
 				# skip the file_parent if it's the same as the file_name
-				delete $params{'file_parent'} if $params{'file_parent'} eq $params{'file_name'};
-				if (defined $params{'file_parent'} && $params{'file_parent'} !~ /\.\./) {
-					$href .= ":/".esc_url($params{'file_parent'});
-					delete $params{'file_parent'};
+				if (defined $params{'file_parent'}) {
+					if ($params{'file_parent'} eq $params{'file_name'}) {
+						delete $params{'file_parent'};
+					} else if ($params{'file_parent'} !~ /\.\./) {
+						$href .= ":/".esc_url($params{'file_parent'});
+						delete $params{'file_parent'};
+					}
 				}
 				$href .= "..";
 				delete $params{'hash_parent'};
-- 
1.6.3.rc1.192.gdbfcb

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-04  7:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30 21:15 [PATCH] gitweb: suppress 'Use of uninitialized value' error Giuseppe Bilotta
2009-07-30 23:00 ` Jakub Narebski
2009-07-31  6:06   ` Giuseppe Bilotta
2009-07-31  6:24     ` Jakub Narebski
2009-07-31  6:48       ` [PATCH] gitweb: fix 'Use of uninitialized value' error in href() Giuseppe Bilotta
2009-07-31  8:30         ` Jakub Narebski
2009-07-31  8:37           ` Giuseppe Bilotta
2009-07-31 14:51             ` Junio C Hamano
2009-08-04  7:26           ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).