From: David Rientjes Date: Tue, 15 Aug 2006 18:43:04 GMT Subject: Re: [PATCH] gitweb: Show project's git URL on summary page Message-ID: In-Reply-To: <200608152003.05693.jnareb@gmail.com> On Tue, 15 Aug 2006, Jakub Narebski wrote: > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl > index ab28caa..6dcf6a2 100755 > --- a/gitweb/gitweb.perl > +++ b/gitweb/gitweb.perl > @@ -51,6 +51,10 @@ our $logo = "++GITWEB_LOGO++"; > # source of projects list > our $projects_list = "++GITWEB_LIST++"; > > +# list of git base URLs used for URL to where fetch project from, > +# i.e. full URL is "$git_base_url/$project" > +our @git_base_url_list = ("++GIT_BASE_URL++"); > + > # default blob_plain mimetype and default charset for text/plain blob > our $default_blob_plain_mimetype = 'text/plain'; > our $default_text_plain_charset = undef; > @@ -1665,8 +1669,18 @@ sub git_summary { > print "\n" . > "\n" . > "\n" . > - "\n" . > - "
description" . esc_html($descr) . "
owner$owner
last change$cd{'rfc2822'}
\n"; > + "last change$cd{'rfc2822'}\n"; > + my $is_first_url = 1; > + foreach my $git_base_url (@git_base_url_list) { > + next unless $git_base_url; # skip empty/zerolength URLs > + print ""; > + if ($is_first_url) { > + print "URL"; > + $is_first_url = 0; > + } > + print "$git_base_url/$project\n"; > + } > + print "\n"; > > open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_get_head_hash($project) > or die_error(undef, "Open git-rev-list failed"); > Isn't it faster to do this (over 1.4.2): diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index b5b89de..82b246d 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -53,6 +53,7 @@ our $logo = "++GITWEB_LOGO++"; # source of projects list our $projects_list = "++GITWEB_LIST++"; +our @git_base_url_list = ("++GIT_BASE_URL++"); # default blob_plain mimetype and default charset for text/plain blob our $default_blob_plain_mimetype = 'text/plain'; @@ -1668,8 +1669,14 @@ sub git_summary { print "\n" . "\n" . "\n" . - "\n" . - "
description" . esc_html($descr) . "
owner$owner
last change$cd{'rfc2822'}
\n"; + "last change$cd{'rfc2822'}\n"; + my $url_tag = "URL"; + foreach my $git_base_url (@git_base_url_list) { + next unless $git_base_url; + print "$url_tag$git_base_url/$project\n"; + $url_tag = ""; + } + print "\n"; open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_get_head_hash($project) or die_error(undef, "Open git-rev-list failed"); -- All the series of prints in this script could also probably more elegantly be written in the form: print <<"(END HTML)"; ...
last change$cd{'rfc2822'} ... (END HTML) and then all the escape characters around quotes aren't needed. David