support ^(?:/p/|/a/|/) git url
diff --git a/src/backend.c b/src/backend.c
index 3b976f5..6b9a1c5 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -233,6 +233,8 @@
end--;
}
if (p != NULL && (!strncmp(p, "git-receive-pack", 16) || !strncmp(p, "git-upload-pack", 15))) {
+ if (!strncmp(start, "/a/", 3) || !strncmp(start, "/p/", 3))
+ start += 2;
// we have git request here
// get rid of redundant '/'
while ((end - start) > 1 && *(start+1) == '/')
@@ -242,7 +244,9 @@
// get rid of trailing ".git"
if ((end - start) > 4 && strncmp(end-4, ".git", 4) == 0)
end -= 4;
-
+ // get rid of redundant '/'
+ while ((end - start) > 1 && *(end-1) == '/')
+ end--;
hash = gen_hash(px, start, (end - start));
} else {
if (px->uri_dirs_depth1 > 0){