git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/7] gitweb: Add support for per project git URLs

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 17, 2006, 09:21 UTC
Message-ID
<11558064894129-git-send-email-jnareb@gmail.com>
In-Reply-To
<11558064883957-git-send-email-jnareb@gmail.com>

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 <jnareb@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
 gitweb/gitweb.perl |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 37a6284..7c92ac3 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -533,6 +533,16 @@ sub git_get_project_description {
 	return $descr;
 }
 
+sub git_get_project_url_list {
+	my $path = shift;
+
+	open my $fd, "$projectroot/$path/cloneurl" or return undef;
+	my @git_project_url_list = map { chomp; $_ } <$fd>;
+	close $fd;
+
+	return wantarray ? @git_project_url_list : \@git_project_url_list;
+}
+
 sub git_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 name
 	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";
+	my @url_list = git_get_project_url_list($project);
+	@url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
+	foreach my $git_url (@url_list) {
+		next unless $git_url;
+		print "<tr><td>$url_tag</td><td>$git_url</td></tr>\n";
 		$url_tag = "";
 	}
 	print "</table>\n";
-- 
1.4.1.1
Previous: Jakub NarebskiNext: David Rientjes
Message 2 of 12 in “A few gitweb cleanups and improvements”
  1. 0/7 A few gitweb cleanups and improvementsJakub Narebski, Aug 17, 2006
  2. 1/7 gitweb: Add support for per project git URLsJakub Narebski, Aug 17, 2006
  3. David RientjesAug 17, 2006
  4. 2/7 gitweb: Refactor printing commit messageJakub Narebski, Aug 17, 2006
  5. 3/7 gitweb: Fix typo in separation of git_difftree_bodyJakub Narebski, Aug 17, 2006
  6. 4/7 gitweb: Expand href() function to use key as param name for no mappingJakub Narebski, Aug 17, 2006
  7. Junio C HamanoAug 17, 2006
  8. Jakub NarebskiAug 17, 2006
  9. 5/7 gitweb: Added parse_difftree_raw_line function for later useJakub Narebski, Aug 17, 2006
  10. Junio C HamanoAug 17, 2006
  11. 6/7 gitweb: Sort query string parameters in href() functionJakub Narebski, Aug 17, 2006
  12. 7/7 gitweb: Uniquify version info output, add meta generator in page headerJakub Narebski, Aug 17, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.