From: warthog19@eaglescrag.net Date: Mon, 04 Aug 2008 02:00:17 GMT Subject: [PATCH 1/1] Add "git" link to the end of project line on the project_list page. Message-ID: <1217815217-11329-2-git-send-email-warthog19@eaglescrag.net> In-Reply-To: <1217815217-11329-1-git-send-email-warthog19@eaglescrag.net> This makes the assumption that all repositories are available from a unified location. Using .git/cloneurl is actually a problem as that can define multiple URLs to clone from, and we are seeking a single unified URL for now. Signed-off-by: John 'Warthog9' Hawley --- gitweb/gitweb.perl | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 90cd99b..c33f4ed 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -108,6 +108,14 @@ our $mimetypes_file = undef; # could be even 'utf-8' for the old behavior) our $fallback_encoding = 'latin1'; +# enable / disable a final link on the project list page +# that will be the location of that actuall git url +# it will output this in the format: +# git://hostname/path/to/tree.git +# disabled = blank or undef +# enable = url to prefix before filling in the trailing path to the git repo +our $projectlist_gitlinkurl = undef; + # rename detection options for git-diff and git-diff-tree # - default is '-M', with the cost proportional to # (number of removed files) * (number of new files). @@ -3661,8 +3669,11 @@ sub git_project_list_body { $cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"tree")}, "tree") . - ($pr->{'forks'} ? " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"forks")}, "forks") : '') . - "\n" . + ($pr->{'forks'} ? " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"forks")}, "forks") : ''); + if( $projectlist_gitlinkurl != undef && $projectlist_gitlinkurl ne "" ){ + print " | ". $cgi->a({-href => "git://projectlist_gitlinkurl/".esc_html($pr->{'path'})}, "git"); + } + print "\n" . "\n"; } if (defined $extra) {