<?php

require "config.php";
require "git.php";
$repository = $_POST["project"];
$allowAnonymousPushes = isset($_POST["allowAnonymousPushes"]);
if ($repository) {
    createRepository($repository, $allowAnonymousPushes);
}
header('location: index.php');
function getRepositoryByName($name)
{
    $repoFromDb = getRepositoryByNameSoft($name);
    if ($repoFromDb == null) {
        createRepository($name);
        $repoFromDb = getRepositoryByNameSoft($name);
    }
    if ($repoFromDb == null) {
        throw new Exception('Could not find repo by name: ' . $name);
    } else {
        $repo = new Repo();
        $repo->fromDatabase($repoFromDb);
        return $repo;
    }
}