From 43b78ea0976ab7ec013c6a1ace53db98ede89012 Mon Sep 17 00:00:00 2001 From: Paul J R Date: Thu, 25 Oct 2012 06:00:30 +1100 Subject: [PATCH] local clones working... --- gwvpmini/gwvpmini_db.php | 3 ++- gwvpmini/gwvpmini_gitbackend.php | 5 +++++ gwvpmini/gwvpmini_gitrepo.php | 11 ++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gwvpmini/gwvpmini_db.php b/gwvpmini/gwvpmini_db.php index 8b3fd26..dbe294f 100644 --- a/gwvpmini/gwvpmini_db.php +++ b/gwvpmini/gwvpmini_db.php @@ -251,7 +251,8 @@ function gwvpmini_GetRepoPerm($rid, $uid) $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; diff --git a/gwvpmini/gwvpmini_gitbackend.php b/gwvpmini/gwvpmini_gitbackend.php index 5a6c055..a50123b 100644 --- a/gwvpmini/gwvpmini_gitbackend.php +++ b/gwvpmini/gwvpmini_gitbackend.php @@ -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 { diff --git a/gwvpmini/gwvpmini_gitrepo.php b/gwvpmini/gwvpmini_gitrepo.php index ba00862..d9d9fef 100644 --- a/gwvpmini/gwvpmini_gitrepo.php +++ b/gwvpmini/gwvpmini_gitrepo.php @@ -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"); 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 { -- 1.7.0.4