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

Re: [PATCH] gitweb: add readme to overview page

From
Xypron <xypron.glpk@gmx.de>
Date
Nov 29, 2012, 22:30 UTC
Message-ID
<50B7E1FD.8060001@gmx.de>
In-Reply-To
<1352647962-21910-1-git-send-email-xypron.glpk@gmx.de>
Hello Junio,

thank you for your comment in message <7vip9ak971.fsf@alter.siamese.dyndns.org> that message <1352652039-31453-1-git-send-email-xypron.glpk@gmx.de> lost the thread context.

As already described I would be happy if a README.html could be added to the overview page of gitweb.

Please, find below an updated patch. Compared to the first version of my patch it avoids a warning concerning doubled slashes in filenames and adds a subtitle "projects" between the README and the project list.

Best regards
Heinrich Schuchardt
Subject: [PATCH] gitweb: add readme to overview page

For repositories it is possible to maintain a README.html which will be shown on the summary page. This is not possible for the server root.

German law requires to provide contact data on the web server. This data could easily be entered in the overview page using a README.html.

Furthermore it is possible to put the repositories not directly into the root directory but into a subdirectory. Here also a README.html would be helpful to indicate what the subdirectory is about.

The patch introduces README.html functionality for the root directory and all subdirectories.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 gitweb/gitweb.perl |   13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e8812fa..618b0d8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6368,6 +6368,19 @@ sub git_project_list {
 	}
 
 	git_project_search_form($searchtext, $search_use_regexp);
+	# If XSS prevention is on, we don't include README.html.
+	# TODO: Allow a readme in some safe format.
+	my $path = "";
+	if (defined $project_filter) {
+		$path = "/$project_filter";
+	}
+	if (!$prevent_xss && -s "$projectroot$path/README.html") {
+		print "<div class=\"title\">readme</div>\n" .
+		"<div class=\"readme\">\n";
+		insert_file("$projectroot$path/README.html");
+		print "\n</div>\n"; # class="readme"
+	}
+	print "<div class=\"title\">projects</div>\n";
 	git_project_list_body(\@list, $order);
 	git_footer_html();
 }
-- 
1.7.10.4
Previous: Heinrich SchuchardtNext: Xypron
Message 2 of 3 in “gitweb: add readme to overview page”
  1. gitweb: add readme to overview pageHeinrich Schuchardt, Nov 11, 2012
  2. XypronNov 29, 2012
  3. XypronNov 30, 2012

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.