mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
multiple dir's fully tested.
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
client = '/usr/bin/git' ; Your git executable path
|
client = '/usr/bin/git' ; Your git executable path
|
||||||
repositories = '/var/www/projects/' ; Path to your repositories
|
repositories = '/var/www/projects/' ; Path to your repositories
|
||||||
|
|
||||||
|
; If you want to specify multiple paths, use the array syntax instead:
|
||||||
|
;
|
||||||
|
;repositories[] = '/var/www/projects/'
|
||||||
|
;repositories[] = '/var/www/subdir/more_projects/'
|
||||||
|
;repositories[] = '/home/user/even_more_projects/'
|
||||||
|
|
||||||
; You can hide repositories from GitList, just copy this for each repository you want to hide
|
; You can hide repositories from GitList, just copy this for each repository you want to hide
|
||||||
; hidden[] = '/var/www/projects/BetaTest'
|
; hidden[] = '/var/www/projects/BetaTest'
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
#WRI DEBUG
|
|
||||||
echo "<pre>";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GitList 0.3
|
* GitList 0.3
|
||||||
* https://github.com/klaussilveira/gitlist
|
* https://github.com/klaussilveira/gitlist
|
||||||
@@ -20,7 +17,4 @@ $config = GitList\Config::fromFile('config.ini');
|
|||||||
|
|
||||||
$app = require 'boot.php';
|
$app = require 'boot.php';
|
||||||
|
|
||||||
#WRI DEBUG
|
|
||||||
echo "</pre>";
|
|
||||||
|
|
||||||
$app->run();
|
$app->run();
|
||||||
|
|||||||
@@ -49,11 +49,23 @@ class Config
|
|||||||
|
|
||||||
protected function validateOptions()
|
protected function validateOptions()
|
||||||
{
|
{
|
||||||
|
$at_least_one_ok = false;
|
||||||
|
$at_least_one_wrong = false;
|
||||||
|
|
||||||
foreach ( $this->get('git', 'repositories') as $dir ) {
|
foreach ( $this->get('git', 'repositories') as $dir ) {
|
||||||
echo $dir;
|
|
||||||
if (!$dir || !is_dir($dir)) {
|
if (!$dir || !is_dir($dir)) {
|
||||||
die("Please, edit the config file and provide your repositories directory");
|
$at_least_one_wrong = true;
|
||||||
|
} else {
|
||||||
|
$at_least_one_ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !$at_least_one_ok ) {
|
||||||
|
die("Please, edit the config file and provide your repositories directory");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $at_least_one_wrong ) {
|
||||||
|
die("One or more of the supplied repository paths appears to be wrong. Please, check the config file");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class BlobController implements ControllerProviderInterface
|
|||||||
$route = $app['controllers_factory'];
|
$route = $app['controllers_factory'];
|
||||||
|
|
||||||
$route->get('{repo}/blob/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
$route->get('{repo}/blob/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
||||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
||||||
|
|
||||||
$blob = $repository->getBlob("$branch:\"$file\"");
|
$blob = $repository->getBlob("$branch:\"$file\"");
|
||||||
@@ -44,7 +45,9 @@ class BlobController implements ControllerProviderInterface
|
|||||||
->bind('blob');
|
->bind('blob');
|
||||||
|
|
||||||
$route->get('{repo}/raw/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
$route->get('{repo}/raw/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
||||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
|
|
||||||
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
||||||
$blob = $repository->getBlob("$branch:\"$file\"")->output();
|
$blob = $repository->getBlob("$branch:\"$file\"")->output();
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,8 @@ class CommitController implements ControllerProviderInterface
|
|||||||
$route = $app['controllers_factory'];
|
$route = $app['controllers_factory'];
|
||||||
|
|
||||||
$route->get('{repo}/commits/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
$route->get('{repo}/commits/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
||||||
#$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
# NOTE: this call is to the ONE Client!
|
|
||||||
$repositories = $app['git']->getRepositories($app['git.repos']);
|
|
||||||
$path = $repositories[ $repo ]['path'];
|
|
||||||
|
|
||||||
# NOTE: this call is to the OTHER Client!
|
|
||||||
$repository = $app['git']->getRepository($path);
|
|
||||||
|
|
||||||
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
||||||
|
|
||||||
@@ -53,7 +47,9 @@ class CommitController implements ControllerProviderInterface
|
|||||||
->bind('commits');
|
->bind('commits');
|
||||||
|
|
||||||
$route->post('{repo}/commits/search', function(Request $request, $repo) use ($app) {
|
$route->post('{repo}/commits/search', function(Request $request, $repo) use ($app) {
|
||||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
|
|
||||||
$commits = $repository->searchCommitLog($request->get('query'));
|
$commits = $repository->searchCommitLog($request->get('query'));
|
||||||
|
|
||||||
foreach ($commits as $commit) {
|
foreach ($commits as $commit) {
|
||||||
@@ -74,7 +70,9 @@ class CommitController implements ControllerProviderInterface
|
|||||||
->bind('searchcommits');
|
->bind('searchcommits');
|
||||||
|
|
||||||
$route->get('{repo}/commit/{commit}/', function($repo, $commit) use ($app) {
|
$route->get('{repo}/commit/{commit}/', function($repo, $commit) use ($app) {
|
||||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
|
|
||||||
$commit = $repository->getCommit($commit);
|
$commit = $repository->getCommit($commit);
|
||||||
|
|
||||||
return $app['twig']->render('commit.twig', array(
|
return $app['twig']->render('commit.twig', array(
|
||||||
@@ -87,7 +85,8 @@ class CommitController implements ControllerProviderInterface
|
|||||||
->bind('commit');
|
->bind('commit');
|
||||||
|
|
||||||
$route->get('{repo}/blame/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
$route->get('{repo}/blame/{branch}/{file}', function($repo, $branch, $file) use ($app) {
|
||||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
|
|
||||||
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file);
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ class MainController implements ControllerProviderInterface
|
|||||||
})->bind('homepage');
|
})->bind('homepage');
|
||||||
|
|
||||||
$route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) {
|
$route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) {
|
||||||
#$repository = $app['git']->getRepository($app['git.repos'][$repo]);
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
echo "branches\n";
|
|
||||||
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
|
|
||||||
$stats = $repository->getStatistics($branch);
|
$stats = $repository->getStatistics($branch);
|
||||||
$authors = $repository->getAuthorStatistics();
|
$authors = $repository->getAuthorStatistics();
|
||||||
@@ -42,8 +42,8 @@ echo "branches\n";
|
|||||||
->bind('stats');
|
->bind('stats');
|
||||||
|
|
||||||
$route->get('{repo}/{branch}/rss/', function($repo, $branch) use ($app) {
|
$route->get('{repo}/{branch}/rss/', function($repo, $branch) use ($app) {
|
||||||
echo "rss\n";
|
$repotmp = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
$repository = $app['git']->getRepository($repotmp->getPath());
|
||||||
|
|
||||||
$commits = $repository->getPaginatedCommits($branch);
|
$commits = $repository->getPaginatedCommits($branch);
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class TreeController implements ControllerProviderInterface
|
|||||||
->bind('tree');
|
->bind('tree');
|
||||||
|
|
||||||
$route->post('{repo}/tree/{branch}/search', function(Request $request, $repo, $branch = '', $tree = '') use ($app) {
|
$route->post('{repo}/tree/{branch}/search', function(Request $request, $repo, $branch = '', $tree = '') use ($app) {
|
||||||
echo "searc\n";
|
|
||||||
|
|
||||||
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
$path = $repository->getPath();
|
$path = $repository->getPath();
|
||||||
@@ -79,8 +78,6 @@ echo "searc\n";
|
|||||||
# WRI: Changed order of this and next statement, because order
|
# WRI: Changed order of this and next statement, because order
|
||||||
# appears to be important, and the other statement got precedence
|
# appears to be important, and the other statement got precedence
|
||||||
$route->get('{repo}/{format}ball/{branch}', function($repo, $format, $branch) use ($app) {
|
$route->get('{repo}/{format}ball/{branch}', function($repo, $format, $branch) use ($app) {
|
||||||
echo "tarball\n";
|
|
||||||
|
|
||||||
$repo_item = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
$repo_item = $app['git']->getRepositoryCached($app['git.repos'], $repo);
|
||||||
$path = $repo_item->getPath();
|
$path = $repo_item->getPath();
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ class Client extends BaseClient
|
|||||||
*/
|
*/
|
||||||
public function getRepository($path)
|
public function getRepository($path)
|
||||||
{
|
{
|
||||||
echo "this getRepository2\n";
|
|
||||||
|
|
||||||
if (!file_exists($path) || !file_exists($path . '/.git/HEAD') && !file_exists($path . '/HEAD')) {
|
if (!file_exists($path) || !file_exists($path . '/.git/HEAD') && !file_exists($path . '/HEAD')) {
|
||||||
throw new \RuntimeException('There is no GIT repository at ' . $path);
|
throw new \RuntimeException('There is no GIT repository at ' . $path);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user