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

[PATCH] gitweb/README: fix AliasMatch in example

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Jun 27, 2009, 16:24 UTC
Message-ID
<1246119851-22154-1-git-send-email-giuseppe.bilotta@gmail.com>

When combining "dumb client" and human-friendly access by using the '.git' extension to switch between the two, make sure the AliasMatch covers the entire request. Without a full match, a request for

http://git.example.com/project/shortlog/branch..gitsomething

would result in a 404 because the server would try to access the the project 'project/shortlog/branch.'

The solution is still not bulletproof, so document the possible failing case.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitweb/README |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
I got bitten by this myself, hence the quick patch.
diff --git a/gitweb/README b/gitweb/README
index ccda890..9056d1e 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -377,7 +377,7 @@ named without a .git extension (e.g. /pub/git/project instead of
 
 	DocumentRoot /var/www/gitweb
 
-	AliasMatch ^(/.*?)(\.git)(/.*)? /pub/git$1$3
+	AliasMatch ^(/.*?)(\.git)(/.*)?$ /pub/git$1$3
 	<Directory /var/www/gitweb>
 		Options ExecCGI
 		AddHandler cgi-script cgi
@@ -402,6 +402,14 @@ http://git.example.com/project
 
 will provide human-friendly gitweb access.
 
+This solution is not 100% bulletproof, in the sense that if some project
+has a named ref (branch, tag) starting with 'git/', then paths such as
+
+http://git.example.com/project/command/abranch..git/abranch
+
+will fail with a 404 error.
+
+
 
 Originally written by:
   Kay Sievers <kay.sievers@vrfy.org>
-- 
1.6.3.rc1.192.gdbfcb
Message 1 of 1 in “gitweb/README: fix AliasMatch in example”
  1. gitweb/README: fix AliasMatch in exampleGiuseppe Bilotta, Jun 27, 2009

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.