From 7a9b4c5fe3b8d291063c398ecb655281a60b2be7 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Wed, 21 Jun 2006 09:48:02 +0200 Subject: [PATCH 1/3] gitweb: whitespace cleanup Do not use tabs to align variable initialization (actually use tabs only at the beginning of line, for code indent). Remove trailing whitespace. Make whitespace usage more consistent. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.cgi | 38 +++++++++++++++++++------------------- gitweb/gitweb.css | 4 ++-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 44896bb300..89224e60b7 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -17,33 +17,33 @@ use Fcntl ':mode'; binmode STDOUT, ':utf8'; my $cgi = new CGI; -my $version = "267"; -my $my_url = $cgi->url(); -my $my_uri = $cgi->url(-absolute => 1); -my $rss_link = ""; +my $version = "267"; +my $my_url = $cgi->url(); +my $my_uri = $cgi->url(-absolute => 1); +my $rss_link = ""; # absolute fs-path which will be prepended to the project path -#my $projectroot = "/pub/scm"; -my $projectroot = "/home/kay/public_html/pub/scm"; +#my $projectroot = "/pub/scm"; +my $projectroot = "/home/kay/public_html/pub/scm"; # location of the git-core binaries -my $gitbin = "/usr/bin"; +my $gitbin = "/usr/bin"; # location for temporary files needed for diffs -my $git_temp = "/tmp/gitweb"; +my $git_temp = "/tmp/gitweb"; # target of the home link on top of all pages -my $home_link = $my_uri; +my $home_link = $my_uri; # html text to include at home page -my $home_text = "indextext.html"; +my $home_text = "indextext.html"; # URI of default stylesheet -my $stylesheet = "gitweb.css"; +my $stylesheet = "gitweb.css"; # source of projects list -#my $projects_list = $projectroot; -my $projects_list = "index/index.aux"; +#my $projects_list = $projectroot; +my $projects_list = "index/index.aux"; # default blob_plain mimetype and default charset for text/plain blob my $default_blob_plain_mimetype = 'text/plain'; @@ -51,7 +51,7 @@ my $default_text_plain_charset = undef; # file to use for guessing MIME types before trying /etc/mime.types # (relative to the current git repository) -my $mimetypes_file = undef; +my $mimetypes_file = undef; # input validation and dispatch @@ -349,7 +349,7 @@ sub git_footer_html { sub die_error { my $status = shift || "403 Forbidden"; - my $error = shift || "Malformed query, file missing or permission denied"; + my $error = shift || "Malformed query, file missing or permission denied"; git_header_html($status); print "
\n" . @@ -1066,7 +1066,7 @@ sub git_summary { ""; if (length($co{'title_short'}) < length($co{'title'})) { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"}, - "" . esc_html($co{'title_short'}) . "$ref"); + "" . esc_html($co{'title_short'}) . "$ref"); } else { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, "" . esc_html($co{'title'}) . "$ref"); @@ -1124,7 +1124,7 @@ sub git_summary { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'}); if ($tag{'reftype'} eq "commit") { print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); } print "\n" . ""; @@ -1362,7 +1362,7 @@ sub git_tags { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'}); if ($tag{'reftype'} eq "commit") { print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log"); } print "\n" . ""; @@ -1942,7 +1942,7 @@ sub git_commit { "" . "\n"; } - print "". + print "". "
\n"; print "
\n"; my $comment = $co{'comment'}; diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index ac6a3c774d..98410f5b6c 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -1,7 +1,7 @@ body { font-family: sans-serif; font-size: 12px; - border:solid #d9d8d1; + border: solid #d9d8d1; border-width: 1px; margin: 10px; background-color: #ffffff; @@ -33,7 +33,7 @@ div.page_header a:hover { } div.page_nav { - padding:8px; + padding: 8px; } div.page_nav a:visited { From ae20de5386f74dbde991186694cfdac323b21e47 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Wed, 21 Jun 2006 09:48:03 +0200 Subject: [PATCH 2/3] Add git version to gitweb output Add git-core binaries used version as the comment at the beginning of HTML output, just below the comment with version of git web interface version. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.cgi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 89224e60b7..87ec565f63 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -29,6 +29,14 @@ my $projectroot = "/home/kay/public_html/pub/scm"; # location of the git-core binaries my $gitbin = "/usr/bin"; +# version of the git-core binaries +my $git_version = qx($gitbin/git --version); +if ($git_version =~ m/git version (.*)$/) { + $git_version = $1; +} else { + $git_version = "unknown"; +} + # location for temporary files needed for diffs my $git_temp = "/tmp/gitweb"; @@ -288,11 +296,12 @@ sub git_header_html { + - $title + $rss_link @@ -816,7 +825,7 @@ sub git_get_project_config { $key =~ s/^gitweb\.//; return if ($key =~ m/\W/); - my $val = qx(git-repo-config --get gitweb.$key); + my $val = qx($gitbin/git-repo-config --get gitweb.$key); return ($val); } From 3f7f271004cd6b8f98bc4437408411c96a4766eb Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Wed, 21 Jun 2006 09:48:04 +0200 Subject: [PATCH 3/3] Move $gitbin earlier in gitweb.cgi (cherry picked from 9dca843086356b964f27d8fabe1e3c48074a9f02 commit) Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.cgi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 87ec565f63..ef7fcbd84f 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -22,13 +22,13 @@ my $my_url = $cgi->url(); my $my_uri = $cgi->url(-absolute => 1); my $rss_link = ""; +# location of the git-core binaries +my $gitbin = "/usr/bin"; + # absolute fs-path which will be prepended to the project path #my $projectroot = "/pub/scm"; my $projectroot = "/home/kay/public_html/pub/scm"; -# location of the git-core binaries -my $gitbin = "/usr/bin"; - # version of the git-core binaries my $git_version = qx($gitbin/git --version); if ($git_version =~ m/git version (.*)$/) {