[PATCH] gitweb: Add support for cloneurl.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aneesh Kumar K.V wrote:
http://gitweb.freedesktop.org/?p=PolicyKit.git;a=summary

This shows it in the URL part of each project.
-aneesh


The below patch implements the same. I am not sure whether the approach is the right one.
To see the results you can see
http://git.openssi.org/~kvaneesh/gitweb.cgi

-aneesh
>From 87503bfc92210ab6791f7a15eba72682d60f74ca Mon Sep 17 00:00:00 2001
Subject: [PATCH] gitweb: Add support for cloneurl.

A new file cloneurl is added below .git directory for each project.
The contents of the file is displayed by gitweb as the url which
need to be used for git clone.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxx>
---
 gitweb/gitweb.perl |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b5b89de..869c53e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -503,6 +503,16 @@ sub git_get_project_description {
 	return $descr;
 }
 
+sub git_get_project_cloneurl {
+	my $path = shift;
+
+	open my $fd, "$projectroot/$path/cloneurl" or return undef;
+	my $descr = <$fd>;
+	close $fd;
+	chomp $descr;
+	return $descr;
+}
+
 sub git_get_projects_list {
 	my @list;
 
@@ -1655,6 +1665,7 @@ sub git_project_list {
 sub git_summary {
 	my $descr = git_get_project_description($project) || "none";
 	my $head = git_get_head_hash($project);
+	my $cloneurl = git_get_project_cloneurl($project) || "none";
 	my %co = parse_commit($head);
 	my %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
 
@@ -1669,6 +1680,7 @@ sub git_summary {
 	      "<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
 	      "<tr><td>owner</td><td>$owner</td></tr>\n" .
 	      "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
+	      "<tr><td>URL</td><td>$cloneurl</td></tr>\n" .
 	      "</table>\n";
 
 	open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_get_head_hash($project)
-- 
1.4.2.rc1.g83e1-dirty


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]