-
Notifications
You must be signed in to change notification settings - Fork 1
/
git.php
60 lines (59 loc) · 1.66 KB
/
git.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @copyright Andreas Dirmeier (C) 2018
*
* This file is part of CcGitServer.
*
* CcGitServer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CcGitServer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CcGitServer. If not, see <http://www.gnu.org/licenses/>.
**/
/**
* @file
* @brief This file is the main entry point for CcGitServer
*
* This file can be called from webser with redirect (look at .htaccess file) or
* from commandline:
*
* Commandline options:
* - **create PathToNewProject**
* create Project at "PathToNewProject"
*
* Example for creating a directory:
*
* php git.php create ExampleProject
*
* The command will generate a project named ExampleProject.git in current directory
*/
require_once 'CcHttp.php';
require_once 'CcGitServer.php';
/**
* Create common git server
* @var CcGitServer $oGitServer
*/
$oGitServer = new NGitServer\CcGitServer();
// Check if path is a valid repository
if($oGitServer->isRepository())
{
// start server
$oGitServer->start();
}
else if(!$oGitServer->isWeb())
{
// We are on cli, so start server too
$oGitServer->start();
}
else
{
NGitServer\CcHttp::errorNotFound();
echo "Repository not found";
}