added the ability to clone a repo via a bundle... tonnes of fun that
[gwvp.git] / gwvplib / gwvpgitcontrol.php
index 2755859..68935a2 100644 (file)
@@ -22,7 +22,7 @@ function gwvp_gitControlCallMe()
        
 }
 
-function gwvp_repoPermissionCheck()
+function gwvp_repoPermissionCheck($repo, $user)
 {
        return true;
 }
@@ -127,11 +127,22 @@ function gwvp_repoExists($name)
        else return false;
 }
 
-function gwvp_createGitRepo($name)
+function gwvp_createGitRepo($name, $bundle=null)
 {
        global $repo_base;
        
-       error_log("would create $repo_base/$name.git");
+       // phew, this works, but i tell you this - bundles arent quite as nice as they should be
+       if($bundle == null) {
+               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");
+       } else {
+               error_log("create via mirror on $repo_base/$name.git");
+               exec("/usr/bin/git clone --mirror $bundle $repo_base/$name.git > /tmp/gitlog 2>&1");
+               chdir("$repo_base/$name.git");
+               exec("/usr/bin/git update-server-info");
+       }
        
        return true;
 }