3 $CALL_ME_FUNCTIONS["repoadmin"] = "gwvp_gitControlCallMe";
5 //$MENU_ITEMS["20repos"]["text"] = "Repo Admin";
6 //$MENU_ITEMS["20repos"]["link"] = "$BASE_URL/admin/repos";
8 function gwvp_gitControlCallMe()
10 if(isset($_REQUEST["q"])) {
11 $query = $_REQUEST["q"];
12 $qspl = explode("/", $query);
14 if($qspl[0] == "git") {
15 return "gwvp_gitBackendInterface";
25 function gwvp_gitBackendInterface()
27 // we need to quite a bit of parsing in here. The "repo" will always be /git/repo.git
28 // but if we get here from a browser, we need to forward back to a normal repo viewer
29 // the only way i can think of doing this is to check the useragent for the word "git"
33 * 1) figure out the repo its acessing
34 * 2) figure out the perms on the repo
35 * 3) determine if its a pull or a push
36 * - if its a pull, we just serve straight from the fs
37 * - if its a push, we go thru git-http-backend
38 * 4) if it requiers auth, we push to auth
41 $agent = "git-unknown";
43 if(isset($_SERVER["HTTP_USER_AGENT"])) {
44 $agent = $_SERVER["HTTP_USER_AGENT"];
45 error_log("in git backend with user agent");
46 if(stristr($agent, "git")!==false) {
52 if(isset($_REQUEST["q"])) {
53 $query = $_REQUEST["q"];
54 $qspl = explode("/", $query);
58 if($isgitagent) echo "GIT: i am a git backened interface for a repo $repo, agent $agent";
59 else echo "NOT GIT: i am a git backened interface for a repo $repo, agent $agent";
62 function gwvp_repoExists($name)
66 if(file_exists("$repo_base/$name.git")) return true;
70 function gwvp_createGitRepo($name)
74 error_log("would create $repo_base/$name.git");