support ^(?:/p/|/a/|/) git url
Change-Id: I286938b76604c50afda91fa7f1499f4ebbf7a9c0
(cherry picked from commit dbd795ee172dd532656ddc758f175632c627ec5f)
diff --git a/src/backend.c b/src/backend.c
index 92d1016..8720502 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -256,7 +256,9 @@
end--;
}
if (p != NULL && (!strncmp(p, "git-receive-pack", 16) || !strncmp(p, "git-upload-pack", 15))) {
- // we have git request here
+ 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) == '/')
start++;
@@ -265,7 +267,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->lbprm.arg_opt3 > 0){