local clones working...
authorPaul J R <me@pjr.cc>
Wed, 24 Oct 2012 19:00:30 +0000 (06:00 +1100)
committerPaul J R <me@pjr.cc>
Wed, 24 Oct 2012 19:00:30 +0000 (06:00 +1100)
gwvpmini/gwvpmini_db.php
gwvpmini/gwvpmini_gitbackend.php
gwvpmini/gwvpmini_gitrepo.php

index 8b3fd26..dbe294f 100644 (file)
@@ -251,7 +251,8 @@ function gwvpmini_GetRepoPerm($rid, $uid)
        \r
        $permsarray = unserialize(base64_decode($cperms_t));
        
-       // error_log("PERMSARRAY: ".print_r($permsarray,true));
+       error_log("PERMSARRAY: with call for $rid and user $uid ".print_r($permsarray,true));
+       
        
        
        $perm = 0;
index 5a6c055..a50123b 100644 (file)
@@ -422,6 +422,11 @@ function gwvpmini_createGitRepo($name, $ownerid, $desc, $defperms, $clonefrom, $
                error_log("how did i end up in clonefrom? $clonefrom");
                if(!$isremoteclone) {
                        exec("/usr/bin/git clone --bare $repo_base/$clonefrom.git $repo_base/$name.git >> /tmp/gitlog 2>&1");
+                       gwvpmini_AddRepo($name, $desc, $ownerid, $defperms, $clonefrom);
+               } else {
+                       // we do this from an outside call in the background
+                       gwvpmini_SendMessage(error, "Cant clone from remote repos yet");
+                       return false;
                }
        } else {
        
index ba00862..d9d9fef 100644 (file)
@@ -235,14 +235,14 @@ function gwvpmini_RepoCreate()
                $uid = $_SESSION["id"];
                
                if($rn == false) {
-                       gwvpmini_SendMessage("error", "local repo $clonefrom given as upstream clone, however $clonefrom doesnt exist on this site (or you cant read it)");
+                       gwvpmini_SendMessage("error", "local repo $clonefrom given as upstream clone, however $clonefrom doesnt exist on this site (or you cant read it unbake)");
                        header("Location: $BASE_URL/repos");
                        return;
                }
                
                // resolve repo permissions on the read/clone
-               if(gwvpmini_GetRepoPerm($rn, $uid) < 1) {
-                       gwvpmini_SendMessage("error", "local repo $clonefrom given as upstream clone, however $clonefrom doesnt exist on this site (or you cant read it)");
+               if(gwvpmini_GetRepoPerm($rn["id"], $uid) < 1) {
+                       gwvpmini_SendMessage("error", "local repo $clonefrom given as upstream clone, however $clonefrom doesnt exist on this site (or you cant read it bake)");
                        header("Location: $BASE_URL/repos");
                        return;
                }
@@ -267,8 +267,9 @@ function gwvpmini_RepoCreate()
                        gwvpmini_SendMessage("error", "Repo ".$_REQUEST["reponame"]." already exists");\r
                        header("Location: $BASE_URL/repos");
                } else {
-                       gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"], $defperms, $clonefrom, $fromremote);
-                       gwvpmini_SendMessage("info", "Repo ".$_REQUEST["reponame"]." has been created");
+                       if(gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"], $defperms, $clonefrom, $fromremote)) {
+                               gwvpmini_SendMessage("info", "Repo ".$_REQUEST["reponame"]." has been created");
+                       }
                        header("Location: $BASE_URL/repos");
                }
        } else {