{"thread":{"id":"34613","subject":"git-http-backend vs gitweb pathinfo mode","startedAt":"2013-08-05T15:34:49Z","lastAt":"2013-08-05T15:51:48Z","messageCount":2,"participants":["Tony Finch"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"224584","messageId":"alpine.LSU.2.00.1308051624570.16837@hermes-2.csi.cam.ac.uk","threadId":"34613","inReplyTo":null,"subject":"git-http-backend vs gitweb pathinfo mode","fromName":"Tony Finch","fromEmail":"dot@dotat.at","sentAt":"2013-08-05T15:34:49Z","receivedAt":"2013-08-05T15:34:49Z","isPatch":false,"sender":{"key":"dot@dotat.at","avatar":"https://avatars.githubusercontent.com/u/68429?v=4"},"body":"Background:\n\nYou cam make the same URL work for gitwe and git clone as described in\ngit-http-backend(1). It says:\n\n   To serve gitweb at the same url, use a ScriptAliasMatch to only\n   those URLs that git http-backend can handle, and forward the rest\n   to gitweb:\n\n       ScriptAliasMatch \\\n               \"(?x)^/git/(.*/(HEAD | \\\n                               info/refs | \\\n                               objects/(info/[^/]+ | \\\n                                        [0-9a-f]{2}/[0-9a-f]{38} | \\\n                                        pack/pack-[0-9a-f]{40}\\.(pack|idx)) | \\\n                               git-(upload|receive)-pack))$\" \\\n               /usr/libexec/git-core/git-http-backend/$1\n\n       ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/\n\nGitweb has a friendly URL mode that uses pathinfo instead of query\nparameters.\n\nProblem:\n\nIn pathinfo mode, gitweb sometimes produces URLs ending in /HEAD which\nmatch the git-http-backend regex and therefore get passed to the wrong\nCGI.\n\nFor example, go to https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree\nand click on the gitweb subdirectory which takes you to\nhttps://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD:/gitweb\nthen click on [git/git.git] to go back, which takes you to\nhttps://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD\n\nHalf-arsed solution:\n\nI have amended the regex to start like\n\n               \"(?x)^/git/(.*/((?<=[.]git/)HEAD | \\\n\nwhich solves the problem for me since all my repos have names ending in\n.git and this doesn't clash with any gitweb action names. I don't think\nthis is a general solution because some people like bare extensionless\nrepo names. On the other hand I don't think the regex should list all the\ndozens of gitweb action names. So I'm not sure what the best fix is.\n\nTony.\n-- \nf.anthony.n.finch  <dot@dotat.at>  http://dotat.at/\nForties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.\nRough, becoming slight or moderate. Showers, rain at first. Moderate or good,\noccasionally poor at first.\n"},{"id":"224587","messageId":"alpine.LSU.2.00.1308051650090.16837@hermes-2.csi.cam.ac.uk","threadId":"34613","inReplyTo":"alpine.LSU.2.00.1308051624570.16837@hermes-2.csi.cam.ac.uk","subject":"Re: git-http-backend vs gitweb pathinfo mode","fromName":"Tony Finch","fromEmail":"dot@dotat.at","sentAt":"2013-08-05T15:51:48Z","receivedAt":"2013-08-05T15:51:48Z","isPatch":false,"sender":{"key":"dot@dotat.at","avatar":"https://avatars.githubusercontent.com/u/68429?v=4"},"body":"Tony Finch <dot@dotat.at> wrote:\n>\n> For example, go to https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree\n> and click on the gitweb subdirectory which takes you to\n> https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD:/gitweb\n> then click on [git/git.git] to go back, which takes you to\n> https://git.csx.cam.ac.uk/i/ucs/git/git.git/tree/HEAD\n\nWhoops, those are the internal not the external URLs... try:\n\n   https://git.csx.cam.ac.uk/x/ucs/git/git.git/tree\n-> https://git.csx.cam.ac.uk/x/ucs/git/git.git/tree/HEAD:/gitweb\n-> https://git.csx.cam.ac.uk/x/ucs/git/git.git/tree/HEAD\n\nTony.\n-- \nf.anthony.n.finch  <dot@dotat.at>  http://dotat.at/\nForties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.\nRough, becoming slight or moderate. Showers, rain at first. Moderate or good,\noccasionally poor at first.\n"}]}