"repos_owner" INTEGER,
"repos_perms" TEXT,
"repos_status" TEXT,
+ "repos_origin" TEXT,
UNIQUE(repos_name)\r
)';\r
\r
return $conn->query($sql);\r
}
-function gwvpmini_AddRepo($name, $desc, $ownerid)
+function gwvpmini_AddRepo($name, $desc, $ownerid, $clonefrom)
{
// error_log("addrepo in db for $name, $desc, $ownerid");
$perms["b"] = "a";
$encperms = base64_encode(serialize($perms));
+
+ if($clonefrom === false) $clonefrom = "";
\r
- $sql = "insert into repos values (null, '$name', '$desc', '$ownerid', '$encperms', 0)";\r
+ $sql = "insert into repos values (null, '$name', '$desc', '$ownerid', '$encperms', 0, '$clonefrom')";\r
\r
$conn->query($sql);\r
}
// 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)
+function gwvpmini_createGitRepo($name, $ownerid, $desc, $clonefrom)
{
$repo_base = gwvpmini_getConfigVal("repodir");
exec("/usr/bin/git update-server-info");
// gwvpmini_AddRepo($reponame, $repodesc, $repoowner, $defaultperms = 0)
- gwvpmini_AddRepo($name, $desc, $ownerid);
+ gwvpmini_AddRepo($name, $desc, $ownerid, $clonefrom);
return true;
}
echo "<option value=\"perms-registered\">Must be Registered To Read</option>";
echo "<option value=\"perms-onlywrite\">Only Writers can Read</option>";
echo "</select>";
+ echo "<tr><th>Clone From</th><td><input type=\"text\" name=\"clonefrom\"></td></tr>";
echo "</td></tr>";
echo "<tr><td colspan=\"2\"><input type=\"submit\" name=\"Create\" value=\"Create\"></td></tr>";
echo "</table>";
$inputcheckerror = "Repo name contains invalid characters, repos can only contain a-z, A-Z, 0-9, _, - and .";
}
+ $clonefrom = false;
+ if(isset($_REQUEST["clonefrom"])) {
+ if($_REQUEST["clonefrom"] != "") {
+ $clonefrom = $_REQUEST["clonefrom"];
+ }
+ }
+
if(!$inputcheck) {
gwvpmini_SendMessage("error", "$inputcheckerror");\r
header("Location: $BASE_URL/repos");
gwvpmini_SendMessage("error", "Repo ".$_REQUEST["reponame"]." already exists");\r
header("Location: $BASE_URL/repos");
} else {
- gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"], $_REQUEST["perms"]);
+ gwvpmini_createGitRepo($_REQUEST["reponame"], $_SESSION["id"], $_REQUEST["repodesc"], $_REQUEST["perms"], $clonefrom);
gwvpmini_SendMessage("info", "Repo ".$_REQUEST["reponame"]." has been created");
header("Location: $BASE_URL/repos");
}