X-Git-Url: http://git.pjr.cc/?a=blobdiff_plain;f=gwvpmini%2Fgwvpmini_gitbackend.php;h=a50123b988a8e50b8456caabd8c046f238e4097f;hb=43b78ea0976ab7ec013c6a1ace53db98ede89012;hp=f55038cfebb081a7da4db6a766bb8de2090bc2df;hpb=c06a72c606faf4936f044c3d42372989ad3851ec;p=gwvp-mini.git diff --git a/gwvpmini/gwvpmini_gitbackend.php b/gwvpmini/gwvpmini_gitbackend.php index f55038c..a50123b 100644 --- a/gwvpmini/gwvpmini_gitbackend.php +++ b/gwvpmini/gwvpmini_gitbackend.php @@ -107,7 +107,8 @@ function gwvpmini_gitBackendInterface() // we do an update server cause its weird and i cant figure out when it actually needs to happen chdir("$repo_base/$repo.git"); - exec("/usr/bin/git update-server-info"); + // dont believe i have to do this + //exec("/usr/bin/git update-server-info"); if(!file_exists("$repo_base/$repo.git/hooks/pre-receive") || !file_exists("$repo_base/$repo.git/hooks/update")) { // error_log("WRITING HOOKS"); @@ -380,7 +381,7 @@ function gwvpmini_callGitBackend($username, $repo) usleep(200000); // error_log("sleep tick"); $stlimit++; - if($stlimit > 2) $continue = false; + if($stlimit > 50) $continue = false; } else { $stlimit = 0; // error_log("sizes: $client_len, $cgi_len"); @@ -413,18 +414,31 @@ function gwvpmini_repoExists($name) // 0 - anyone can clone/read, only owner can write // 1 - noone can clone/read, repo is visible (i.e. name), only owner can read/write repo // 2 - only owner can see anything -function gwvpmini_createGitRepo($name, $ownerid, $desc, $clonefrom) +function gwvpmini_createGitRepo($name, $ownerid, $desc, $defperms, $clonefrom, $isremoteclone) { $repo_base = gwvpmini_getConfigVal("repodir"); + if($clonefrom !== false) { + 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 { + // phew, this works, but i tell you this - bundles arent quite as nice as they should be // error_log("would create $repo_base/$name.git"); - exec("/usr/bin/git init $repo_base/$name.git --bare > /tmp/gitlog 2>&1"); - chdir("$repo_base/$name.git"); - exec("/usr/bin/git update-server-info"); - - // gwvpmini_AddRepo($reponame, $repodesc, $repoowner, $defaultperms = 0) - gwvpmini_AddRepo($name, $desc, $ownerid, $clonefrom); + exec("/usr/bin/git init $repo_base/$name.git --bare >> /tmp/gitlog 2>&1"); + chdir("$repo_base/$name.git"); + exec("/usr/bin/git update-server-info"); + + // gwvpmini_AddRepo($reponame, $repodesc, $repoowner, $defaultperms = 0) + gwvpmini_AddRepo($name, $desc, $ownerid, $defperms, $clonefrom); + } return true; }