threads / patch / 26183

patch, 2 partsgitweb: make logo optional

Subject: [PATCH 0/2] gitweb: make logo optional

## tl;dr

8 messages between Jan 4, 2011 and Jan 5, 2011. Diffs are folded; open one to read it.

replies: 7people: 4as markdown or json

Jonathan Nieder· Jan 4, 2011, 05:02 UTC · lore

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
Jonathan Nieder· Jan 4, 2011, 05:02 UTC · re: Jonathan Nieder · lore

[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.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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 4779618..c65af1a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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";
 		}
-- 
1.7.4.rc0
Jakub Narebski· Jan 5, 2011, 00:25 UTC · re: Jonathan Nieder · lore

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

Jonathan Nieder wrote:
Show 8 quoted lines
> 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.
> 
> Acked-by: Eric Wong <normalperson@yhbt.net>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Good catch.  As an obvious bugfix:
Acked-by: Jakub Narebski <jnareb@gmail.com>
Show 21 quoted lines
> ---
>  gitweb/gitweb.perl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 4779618..c65af1a 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -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";
>  		}
> -- 
> 1.7.4.rc0
> 
> 
-- 
Jakub Narebski
Poland
Jonathan Nieder· Jan 4, 2011, 05:05 UTC · re: Jonathan Nieder · lore

[PATCH 2/2] gitweb: make logo optional

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.)

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
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(-)
Show changes to gitweb/gitweb.perl +9 −4
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c65af1a..064697c 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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));
-- 
1.7.4.rc0
Jakub Narebski· Jan 4, 2011, 11:52 UTC · re: Jonathan Nieder · lore

Re: [PATCH 2/2] gitweb: make logo optional

On Tue, 4 Dec 2011, Jonathan Nieder wrote:
> 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.

> 
> 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).

> 
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
For what it is worth it:
Acked-by: Jakub Narebski <jnareb@gmail.com>
-- 
Jakub Narebski
Poland
Jonathan Nieder· Jan 4, 2011, 16:29 UTC · re: Jakub Narebski · lore

Re: [PATCH 2/2] gitweb: make logo optional

Jakub Narebski wrote:
> On Tue, 4 Dec 2011, Jonathan Nieder wrote:
Show 6 quoted lines
>> 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.

Show 10 quoted 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).
>
>>
>> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
>
> For what it is worth it:
>
> Acked-by: Jakub Narebski <jnareb@gmail.com>
Thanks for looking it over.
Eric Wong· Jan 4, 2011, 23:24 UTC · re: Jonathan Nieder · lore

Re: [PATCH 0/2] gitweb: make logo optional

Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 7 quoted lines
> 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 :>)

Acked-by: Eric Wong <normalperson@yhbt.net>
-- 
Eric Wong

← back to recent threads