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

2 messages from 2012-11-11 to 2012-11-12. Participants: Heinrich Schuchardt, Junio C Hamano.
Thread: https://gitlist.dev/t/32076

## Heinrich Schuchardt, 2012-11-11 16:40

Subject: [PATCH] Re:gitweb: add readme to overview page
Message-ID: <1352652039-31453-1-git-send-email-xypron.glpk@gmx.de>
URL: https://gitlist.dev/e/1352652039-31453-1-git-send-email-xypron.glpk%40gmx.de
In-Reply-To: <74707c20a5448989963314a02858c304017b02e3>

```
In this version of the patch the formatting has been corrected.

Warnings for double / in filenames are avoided.

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..699ffac 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

```

## Junio C Hamano, 2012-11-12 17:44

Subject: Re: [PATCH] Re:gitweb: add readme to overview page
Message-ID: <7vip9ak971.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vip9ak971.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1352652039-31453-1-git-send-email-xypron.glpk@gmx.de>

```
Heinrich Schuchardt <xypron.glpk@gmx.de> writes:

> In this version of the patch the formatting has been corrected.
>
> Warnings for double / in filenames are avoided.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>
> ---

The above is *not* a proper log message.

Those of us who are reading the messages on the list would know that
this is a replacement for your earlier

    Message-ID: <1352647962-21910-1-git-send-email-xypron.glpk@gmx.de>

where it has more proper description of the change, but because
nobody will be applying that earlier one to the history (instead,
you would want this version to be applied), the description is lost
in the history.

>  gitweb/gitweb.perl |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 10ed9e5..699ffac 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();
>  }

```
