git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: add readme to overview page
@ 2012-11-11 15:32 Heinrich Schuchardt
  2012-11-29 22:30 ` Xypron
  0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2012-11-11 15:32 UTC (permalink / raw)
  To: git; +Cc: xypron.glpk

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 |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 10ed9e5..30cd028 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6369,6 +6369,18 @@ 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"
+    }
 	git_project_list_body(\@list, $order);
 	git_footer_html();
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-30  1:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-11 15:32 [PATCH] gitweb: add readme to overview page Heinrich Schuchardt
2012-11-29 22:30 ` Xypron
2012-11-30  1:11   ` Xypron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).