Skip to content

Commit 19a8721

Browse files
jnarebJunio C Hamano
authored andcommitted
gitweb: Show project's git URL on summary page
From 31e4de9f22a3b17d4ad0ac800132e4e1a0a15006 Mon Sep 17 00:00:00 2001 From: David Rientjes <[email protected]> Date: Tue, 15 Aug 2006 11:43:04 -0700 Subject: [PATCH] gitweb: Show project's git URL on summary page Add support for showing multiple clone/fetch git URLs for project on a summary page. URL for project is created from base URL and project name. For example for XMMS2 project (xmms.se) the git base URL would be git://git.xmms.se/xmms2. With corrections from David Rientjes <[email protected]> Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: David Rientjes <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 96f1e58 commit 19a8721

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ GITWEB_CONFIG = gitweb_config.perl
126126
GITWEB_HOME_LINK_STR = projects
127127
GITWEB_SITENAME =
128128
GITWEB_PROJECTROOT = /pub/git
129+
GITWEB_BASE_URL =
129130
GITWEB_LIST =
130131
GITWEB_HOMETEXT = indextext.html
131132
GITWEB_CSS = gitweb.css
@@ -622,6 +623,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
622623
-e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
623624
-e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
624625
-e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
626+
-e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
625627
-e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
626628
-e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
627629
-e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \

gitweb/gitweb.perl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
# source of projects list
5555
our $projects_list = "++GITWEB_LIST++";
5656

57+
# list of git base URLs used for URL to where fetch project from,
58+
# i.e. full URL is "$git_base_url/$project"
59+
our @git_base_url_list = ("++GITWEB_BASE_URL++");
60+
5761
# default blob_plain mimetype and default charset for text/plain blob
5862
our $default_blob_plain_mimetype = 'text/plain';
5963
our $default_text_plain_charset = undef;
@@ -1668,8 +1672,14 @@ sub git_summary {
16681672
print "<table cellspacing=\"0\">\n" .
16691673
"<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
16701674
"<tr><td>owner</td><td>$owner</td></tr>\n" .
1671-
"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
1672-
"</table>\n";
1675+
"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n";
1676+
my $url_tag = "URL";
1677+
foreach my $git_base_url (@git_base_url_list) {
1678+
next unless $git_base_url;
1679+
print "<tr><td>$url_tag</td><td>$git_base_url/$project</td></tr>\n";
1680+
$url_tag = "";
1681+
}
1682+
print "</table>\n";
16731683

16741684
open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_get_head_hash($project)
16751685
or die_error(undef, "Open git-rev-list failed");

0 commit comments

Comments
 (0)