Skip to contentSkip to conversation

gitweb: make logo optional

PATCH In review Jonathan Nieder 4 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover gitweb: make logo optional

These patches were last seen in the instaweb 1.7.1 maintenance thread[1] but I believe they are independently useful. The idea is to allow disabling the logo in gitweb.

Jonathan Nieder (2):
gitweb: skip logo in atom feed when there is none
gitweb: make logo optional

 gitweb/gitweb.perl |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

[1] http://thread.gmane.org/gmane.comp.version-control.git/155224

#1 lore raw

PATCH 1/2 gitweb: skip logo in atom feed when there is none

Date: Fri, 3 Sep 2010 19:44:39 -0500

With v1.5.0-rc0~169 (gitweb: Fix Atom feed <logo>: it is $logo, not $logo_url, 2006-12-04), the logo URI to be written to Atom feeds was corrected but the case of no logo forgotten.

---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index 4779618..c65af1a 100755
@@ -7169,7 +7169,7 @@ XML
 		if (defined $favicon) {
 			print "<icon>" . esc_url($favicon) . "</icon>\n";
 		}
-		if (defined $logo_url) {
+		if (defined $logo) {
 			# not twice as wide as tall: 72 x 27 pixels
 			print "<logo>" . esc_url($logo) . "</logo>\n";
 		}
Signature · 1 line
1.7.4.rc0
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] gitweb: skip logo in atom feed when there is none

Quoted 8 lines · Jonathan Nieder

Date: Fri, 3 Sep 2010 19:44:39 -0500

With v1.5.0-rc0~169 (gitweb: Fix Atom feed <logo>: it is $logo, not $logo_url, 2006-12-04), the logo URI to be written to Atom feeds was corrected but the case of no logo forgotten.

Good catch. As an obvious bugfix:

Quoted 21 lines
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index 4779618..c65af1a 100755
@@ -7169,7 +7169,7 @@ XML
 		if (defined $favicon) {
 			print "<icon>" . esc_url($favicon) . "</icon>\n";
 		}
-		if (defined $logo_url) {
+		if (defined $logo) {
 			# not twice as wide as tall: 72 x 27 pixels
 			print "<logo>" . esc_url($logo) . "</logo>\n";
 		}
Signature · 1 line
1.7.4.rc0
Signature · 2 lines
Jakub Narebski
Poland
#3 lore raw

Re: [PATCH 1/2] gitweb: skip logo in atom feed when there is none

Thanks, all.

#4 lore raw

PATCH 2/2 gitweb: make logo optional

In reply to Jonathan Nieder

Date: Fri, 3 Sep 2010 19:45:09 -0500

Some sites may not want to have a logo at all. In particular, git instaweb can benefit from this.

While at it, use $cgi->img to simplify this code. (CGI.pm learned most HTML4 tags by version 2.79, so this should be portable to perl 5.8, though I haven't tested.)

---
Eric liked an earlier version of this patch that did not use $cgi->img.

 gitweb/gitweb.perl |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
gitweb/gitweb.perl +9 -4
index c65af1a..064697c 100755
@@ -3601,10 +3601,15 @@ EOF
 		insert_file($site_header);
 	}
 
-	print "<div class=\"page_header\">\n" .
-	      $cgi->a({-href => esc_url($logo_url),
-	               -title => $logo_label},
-	              qq(<img src=").esc_url($logo).qq(" width="72" height="27" alt="git" class="logo"/>));
+	print "<div class=\"page_header\">\n";
+	if (defined $logo) {
+		print $cgi->a({-href => esc_url($logo_url),
+		               -title => $logo_label},
+		              $cgi->img({-src => esc_url($logo),
+		                         -width => 72, -height => 27,
+		                         -alt => "git",
+		                         -class => "logo"}));
+	}
 	print $cgi->a({-href => esc_url($home_link)}, $home_link_str) . " / ";
 	if (defined $project) {
 		print $cgi->a({-href => href(action=>"summary")}, esc_html($project));
Signature · 1 line
1.7.4.rc0
Acked-by on v1 2/2
#5 lore raw
Quoted 2 lines · Jonathan Nieder

Some sites may not want to have a logo at all. In particular, git instaweb can benefit from this.

Why do you think that git-instaweb can benefit from not having logo? You need gitweb.css anyway, so it is not much more trouble to serve additional static file, git-logo.png.

Quoted 4 lines

While at it, use $cgi->img to simplify this code. (CGI.pm learned most HTML4 tags by version 2.79, so this should be portable to perl 5.8, though I haven't tested.)

corelist (Module::CoreList) says that Perl 5.8.0 has CGI.pm version 2.81; IIRC gitweb requires something later than 5.8.0 for good support of Unicode (Encode module).

Quoted 2 lines

For what it is worth it:

Signature · 2 lines
Jakub Narebski
Poland
#6 lore raw
Quoted 8 lines · Jakub Narebski
Quoted 2 lines · Jonathan Nieder

Some sites may not want to have a logo at all. In particular, git instaweb can benefit from this.

Why do you think that git-instaweb can benefit from not having logo? You need gitweb.css anyway, so it is not much more trouble to serve additional static file, git-logo.png.

Yep, that sentence is stale (it only applied in 1.7.1.x days) and should have been removed.

Quoted 10 lines

corelist (Module::CoreList) says that Perl 5.8.0 has CGI.pm version 2.81; IIRC gitweb requires something later than 5.8.0 for good support of Unicode (Encode module).

Quoted 2 lines

For what it is worth it:

Thanks for looking it over.

Acked-by on the v1 series
#7 lore raw
In reply to Jonathan Nieder
Quoted 7 lines · Jonathan Nieder

These patches were last seen in the instaweb 1.7.1 maintenance thread[1] but I believe they are independently useful. The idea is to allow disabling the logo in gitweb.

Jonathan Nieder (2):
gitweb: skip logo in atom feed when there is none
gitweb: make logo optional

This series looks good to me (especially considering my strong dislike of logos/icons on the web :>)

Signature · 1 line
Eric Wong