... | ... |
@@ -18,16 +18,18 @@ foreach( $repositories as $repo ) { |
18 | 18 |
} |
19 | 19 |
$repositories = $tmp_arr; |
20 | 20 |
|
21 |
-$config->set('git', 'repositories', $repositories); |
|
22 | 21 |
|
23 | 22 |
|
24 | 23 |
// Startup and configure Silex application |
25 | 24 |
$app = new GitList\Application($config, __DIR__); |
26 | 25 |
|
26 |
+ |
|
27 | 27 |
// Mount the controllers |
28 | 28 |
$app->mount('', new GitList\Controller\MainController()); |
29 | 29 |
$app->mount('', new GitList\Controller\BlobController()); |
30 | 30 |
$app->mount('', new GitList\Controller\CommitController()); |
31 | 31 |
$app->mount('', new GitList\Controller\TreeController()); |
32 | 32 |
|
33 |
+ |
|
34 |
+ |
|
33 | 35 |
return $app; |
... | ... |
@@ -37,9 +37,17 @@ class Application extends SilexApplication |
37 | 37 |
'twig.path' => $root . DIRECTORY_SEPARATOR . 'views', |
38 | 38 |
'twig.options' => array('cache' => $root . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'views'), |
39 | 39 |
)); |
40 |
+ |
|
41 |
+ $repositories = $config->get('git', 'repositories'); |
|
42 |
+/* |
|
43 |
+ echo "doing this\n"; |
|
44 |
+ $repositories = $app['git']->getRepositories($repositories); |
|
45 |
+ $config->set('git', 'repositories', $repositories); |
|
46 |
+*/ |
|
47 |
+ |
|
40 | 48 |
$this->register(new GitServiceProvider(), array( |
41 | 49 |
'git.client' => $config->get('git', 'client'), |
42 |
- 'git.repos' => $config->get('git', 'repositories'), |
|
50 |
+ 'git.repos' => $repositories, |
|
43 | 51 |
'git.hidden' => $config->get('git', 'hidden') ? $config->get('git', 'hidden') : array(), |
44 | 52 |
)); |
45 | 53 |
$this->register(new ViewUtilServiceProvider()); |
... | ... |
@@ -13,7 +13,14 @@ class CommitController implements ControllerProviderInterface |
13 | 13 |
$route = $app['controllers_factory']; |
14 | 14 |
|
15 | 15 |
$route->get('{repo}/commits/{branch}/{file}', function($repo, $branch, $file) use ($app) { |
16 |
- $repository = $app['git']->getRepository($app['git.repos'] . $repo); |
|
16 |
+ #$repository = $app['git']->getRepository($app['git.repos'] . $repo); |
|
17 |
+ |
|
18 |
+ # NOTE: this call is to the ONE Client! |
|
19 |
+ $repositories = $app['git']->getRepositories($app['git.repos']); |
|
20 |
+ $path = $repositories[ $repo ]['path']; |
|
21 |
+ |
|
22 |
+ # NOTE: this call is to the OTHER Client! |
|
23 |
+ $repository = $app['git']->getRepository($path); |
|
17 | 24 |
|
18 | 25 |
list($branch, $file) = $app['util.repository']->extractRef($repository, $branch, $file); |
19 | 26 |
|
... | ... |
@@ -24,6 +24,9 @@ class MainController implements ControllerProviderInterface |
24 | 24 |
*/ |
25 | 25 |
|
26 | 26 |
$repositories = $app['git']->getRepositories($app['git.repos']); |
27 |
+echo "Doing that\n"; |
|
28 |
+ #$repositories = $app['git.repos']; |
|
29 |
+print_r( $repositories ); |
|
27 | 30 |
|
28 | 31 |
return $app['twig']->render('index.twig', array( |
29 | 32 |
'repositories' => $repositories, |
... | ... |
@@ -32,7 +35,14 @@ class MainController implements ControllerProviderInterface |
32 | 35 |
|
33 | 36 |
$route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) { |
34 | 37 |
#$repository = $app['git']->getRepository($app['git.repos'][$repo]); |
35 |
- $repository = $app['git']->getRepository($app['git.repos'] . $repo); |
|
38 |
+ |
|
39 |
+ # NOTE: this call is to the ONE Client! |
|
40 |
+ $repositories = $app['git']->getRepositories($app['git.repos']); |
|
41 |
+ $path = $repositories[ $repo ]['path']; |
|
42 |
+ |
|
43 |
+ # NOTE: this call is to the OTHER Client! |
|
44 |
+ $repository = $app['git']->getRepository($path); |
|
45 |
+ |
|
36 | 46 |
$stats = $repository->getStatistics($branch); |
37 | 47 |
$authors = $repository->getAuthorStatistics(); |
38 | 48 |
|
... | ... |
@@ -50,7 +60,15 @@ class MainController implements ControllerProviderInterface |
50 | 60 |
->bind('stats'); |
51 | 61 |
|
52 | 62 |
$route->get('{repo}/{branch}/rss/', function($repo, $branch) use ($app) { |
53 |
- $repository = $app['git']->getRepository($app['git.repos'] . $repo); |
|
63 |
+ #$repository = $app['git']->getRepository($app['git.repos'] ); |
|
64 |
+ |
|
65 |
+ # NOTE: this call is to the ONE Client! |
|
66 |
+ $repositories = $app['git']->getRepositories($app['git.repos']); |
|
67 |
+ $path = $repositories[ $repo ]['path']; |
|
68 |
+ |
|
69 |
+ # NOTE: this call is to the OTHER Client! |
|
70 |
+ $repository = $app['git']->getRepository($path); |
|
71 |
+ |
|
54 | 72 |
$commits = $repository->getPaginatedCommits($branch); |
55 | 73 |
|
56 | 74 |
$html = $app['twig']->render('rss.twig', array( |
... | ... |
@@ -14,7 +14,14 @@ class TreeController implements ControllerProviderInterface |
14 | 14 |
$route = $app['controllers_factory']; |
15 | 15 |
|
16 | 16 |
$route->get('{repo}/tree/{branch}/{tree}/', $treeController = function($repo, $branch = '', $tree = '') use ($app) { |
17 |
- $repository = $app['git']->getRepository($app['git.repos'] . $repo); |
|
17 |
+ |
|
18 |
+ # NOTE: this call is to the ONE Client! |
|
19 |
+ $repositories = $app['git']->getRepositories($app['git.repos']); |
|
20 |
+ $path = $repositories[ $repo ]['path']; |
|
21 |
+ |
|
22 |
+ # NOTE: this call is to the OTHER Client! |
|
23 |
+ $repository = $app['git']->getRepository($path); |
|
24 |
+ |
|
18 | 25 |
if (!$branch) { |
19 | 26 |
$branch = $repository->getHead(); |
20 | 27 |
} |
... | ... |
@@ -39,7 +46,7 @@ class TreeController implements ControllerProviderInterface |
39 | 46 |
'breadcrumbs' => $breadcrumbs, |
40 | 47 |
'branches' => $repository->getBranches(), |
41 | 48 |
'tags' => $repository->getTags(), |
42 |
- 'readme' => $app['util.repository']->getReadme($repo, $branch), |
|
49 |
+ 'readme' => $app['util.repository']->getReadme($repository, $branch), |
|
43 | 50 |
)); |
44 | 51 |
})->assert('repo', $app['util.routing']->getRepositoryRegex()) |
45 | 52 |
->assert('branch', '[\w-._\/]+') |
... | ... |
@@ -47,7 +54,7 @@ class TreeController implements ControllerProviderInterface |
47 | 54 |
->bind('tree'); |
48 | 55 |
|
49 | 56 |
$route->post('{repo}/tree/{branch}/search', function(Request $request, $repo, $branch = '', $tree = '') use ($app) { |
50 |
- $repository = $app['git']->getRepository($app['git.repos'] . $repo); |
|
57 |
+ $repository = $app['git']->getRepository($app['git.repos'][ $repo ]); |
|
51 | 58 |
|
52 | 59 |
if (!$branch) { |
53 | 60 |
$branch = $repository->getHead(); |
... | ... |
@@ -31,6 +31,8 @@ class Client extends BaseClient |
31 | 31 |
*/ |
32 | 32 |
public function getRepository($path) |
33 | 33 |
{ |
34 |
+echo "this getRepository2\n"; |
|
35 |
+ |
|
34 | 36 |
if (!file_exists($path) || !file_exists($path . '/.git/HEAD') && !file_exists($path . '/HEAD')) { |
35 | 37 |
throw new \RuntimeException('There is no GIT repository at ' . $path); |
36 | 38 |
} |
... | ... |
@@ -160,9 +160,9 @@ class Repository |
160 | 160 |
return false; |
161 | 161 |
} |
162 | 162 |
|
163 |
- public function getReadme($repo, $branch = 'master') |
|
163 |
+ public function getReadme($repository, $branch = 'master') |
|
164 | 164 |
{ |
165 |
- $repository = $this->app['git']->getRepository($this->app['git.repos'] . $repo); |
|
165 |
+ #$repository = $this->app['git']->getRepository($this->app['git.repos'][$repo ]); |
|
166 | 166 |
$files = $repository->getTree($branch)->output(); |
167 | 167 |
|
168 | 168 |
foreach ($files as $file) { |
... | ... |
@@ -23,8 +23,9 @@ class Routing |
23 | 23 |
#function ($repo) use ($app) { |
24 | 24 |
# return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#'); |
25 | 25 |
#}, |
26 |
+ # TODO: return keys instead |
|
26 | 27 |
function ($repo) use ($app) { |
27 |
- return $repo['path']; |
|
28 |
+ return $repo['name']; |
|
28 | 29 |
}, |
29 | 30 |
$this->app['git']->getRepositories($this->app['git.repos']) |
30 | 31 |
); |
... | ... |
@@ -9,8 +9,8 @@ |
9 | 9 |
{% for repository in repositories %} |
10 | 10 |
<div class="repository"> |
11 | 11 |
<div class="repository-header"> |
12 |
- <i class="icon-folder-open icon-spaced"></i> <a href="{{ path('repository', {repo: repository.relativePath}) }}">{{ repository.name }}</a> |
|
13 |
- <a href="{{ path('rss', {repo: repository.relativePath, branch: 'master'}) }}"><i class="rss pull-right"></i></a> |
|
12 |
+ <i class="icon-folder-open icon-spaced"></i> <a href="{{ path('repository', {repo: repository.name}) }}">{{ repository.name }}</a> |
|
13 |
+ <a href="{{ path('rss', {repo: repository.name, branch: 'master'}) }}"><i class="rss pull-right"></i></a> |
|
14 | 14 |
</div> |
15 | 15 |
<div class="repository-body"> |
16 | 16 |
<p>{{ repository.description }}</p> |