From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
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.
Signed-off-by: Jakub Narebski <redacted>
---
This probably could be combined with Aneesh Kumar patches
"[PATCH] gitweb: Add support for cloneurl."
"[PATCH] gitweb: Support multiple clone urls"
which reads from clone/fetch URLs from $GIT_DIR/cloneurl file,
i.e. from $projectroot/$project/cloneurl file. Default would be to
use base URL from @git_base_url_list, and if there is cloneurl file
for a project, use it instead.
I'm not so sure of benefits of yet another way to provide
clone/fetch URL, namely Yasushi SHOJI
"[PATCH] gitweb: configurable home link string"
This patch is port (with improvements) of Sham Chukoury patch
"Show project tree git url on summary page" (8e327dfbd)
for gitweb-xmms2. Should I add below line to commit message?
Signed-off-by: Sham Chukoury <redacted>
Makefile | 2 ++
gitweb/gitweb.perl | 18 ++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
@@ -51,6 +51,10 @@ our $logo = "++GITWEB_LOGO++";# source of projects listour$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 blobour$default_blob_plain_mimetype='text/plain';our$default_text_plain_charset=undef;
@@ -51,6 +51,10 @@ our $logo = "++GITWEB_LOGO++";# source of projects listour$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 blobour$default_blob_plain_mimetype='text/plain';our$default_text_plain_charset=undef;
All the series of prints in this script could also probably more elegantly be
written in the form:
print <<"(END HTML)";
<table cellspacing="0">
...
</table>
<tr><td>last change</td><td>$cd{'rfc2822'}</td><tr>
...
(END HTML)
and then all the escape characters around quotes aren't needed.
David
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
On 8/15/06, David Rientjes [off-list ref] wrote:
On Tue, 15 Aug 2006, Jakub Narebski wrote:
quoted
+ my $is_first_url = 1;
+ foreach my $git_base_url (@git_base_url_list) {
+ next unless $git_base_url; # skip empty/zerolength URLs
+ print "<tr><td>";
+ if ($is_first_url) {
+ print "URL";
+ $is_first_url = 0;
+ }
+ print "</td><td>$git_base_url/$project</td></tr>\n";
+ }
Isn't it faster to do this (over 1.4.2):
+ my $url_tag = "URL";
+ foreach my $git_base_url (@git_base_url_list) {
+ next unless $git_base_url;
+ print "<tr><td>$url_tag</td><td>$git_base_url/$project</td></tr>\n";
+ $url_tag = "";
+ }
Yes, it is undobtedly better.
Acked-by: Jakub Narebski <redacted>
--
Jakub Narebski
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
From 31e4de9f22a3b17d4ad0ac800132e4e1a0a15006 Mon Sep 17 00:00:00 2001
From: David Rientjes <rientjes@google.com>
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 [off-list ref]
Signed-off-by: Jakub Narebski <redacted>
---
Makefile | 2 ++
gitweb/gitweb.perl | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
@@ -51,6 +51,10 @@ our $logo = "++GITWEB_LOGO++";# source of projects listour$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=("++GITWEB_BASE_URL++");+# default blob_plain mimetype and default charset for text/plain blobour$default_blob_plain_mimetype='text/plain';our$default_text_plain_charset=undef;
From 31e4de9f22a3b17d4ad0ac800132e4e1a0a15006 Mon Sep 17 00:00:00 2001
From: David Rientjes <rientjes@google.com>
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 [off-list ref]
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: David Rientjes <rientjes@google.com>
From 31e4de9f22a3b17d4ad0ac800132e4e1a0a15006 Mon Sep 17 00:00:00 2001
From: David Rientjes <rientjes@google.com>
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 [off-list ref]
this can give wrong value is some case with index.aux as projects_list. I have a setup where
project details are displayed via gitweb but not reachable via http:// url and some reachable via http:// url.
For the first one only ssh:// based clone mechanism will work and for the other both will work. How do we handle
that
-aneesh
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
It is now possible for project to have individual clone/fetch URLs.
They are provided in new file 'cloneurl' added below project's
$GIT_DIR directory.
If there is no cloneurl file, concatenation of git base URLs with
project name is used.
This is merge of Jakub Narebski and David Rientjes
gitweb: Show project's git URL on summary page
with Aneesh Kumar
gitweb: Add support for cloneurl.
gitweb: Support multiple clone urls
patches.
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Aneesh Kumar K.V <redacted>
---
Based on previous patch.
gitweb/gitweb.perl | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
@@ -533,6 +533,16 @@ sub git_get_project_description {return$descr;}+subgit_get_project_url_list{+my$path=shift;++openmy$fd,"$projectroot/$path/cloneurl"orreturnundef;+my@git_project_url_list=map{chomp;$_}<$fd>;+close$fd;++returnwantarray?@git_project_url_list:\@git_project_url_list;+}+subgit_get_projects_list{my@list;
@@ -1697,10 +1707,14 @@ 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";+# use per project git URL list in $projectroot/$project/cloneurl+# or make project git URL from git base URL and project namemy$url_tag="URL";-foreachmy$git_base_url(@git_base_url_list){-nextunless$git_base_url;-print"<tr><td>$url_tag</td><td>$git_base_url/$project</td></tr>\n";+my@url_list=git_get_project_url_list($project);+@url_list=map{"$_/$project"}@git_base_url_listunless@url_list;+foreachmy$git_url(@url_list){+nextunless$git_url;+print"<tr><td>$url_tag</td><td>$git_url</td></tr>\n";$url_tag="";}print"</table>\n";
From: Jakub Narebski <hidden> Date: 2016-06-15 22:42:37
Aneesh Kumar K.V wrote:
this can give wrong value is some case with index.aux as projects_list.
I have a setup where project details are displayed via gitweb but not
reachable via http:// url and some reachable via http:// url.
For the first one only ssh:// based clone mechanism will work and for
the other both will work. How do we handle that
See my "[PATCH 2/2] gitweb: Add support for per project git URLs" in this
thread.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git